I've downloaded a project from internet, that is supposed to let me draw some polygons, points and so on on the map, then save it on the PostgreSQL database. You can also upload KML files to show already drawn points,polygons, etc - that doesn't work as well.
The project is using PostGis + GeoServer.
The problem is, I don't know how to enable database in it to save the coordinates.
So far I did: 1)Install PostgreSQL 2)Install PostGis 3)Install GeoServer 4)Install WAMP 5)Create database called 'parking' 6) In the 'parking' I've run SQL queries like this :
-- After creating database
CREATE EXTENSION postgis;
-- CREATE SEQUENCE FOR TABLE parking_spaces
CREATE SEQUENCE public.sq_parking_spaces
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1;
-- TABLE parking_spaces
CREATE TABLE public.parking_spaces
(
id integer NOT NULL DEFAULT nextval('sq_parking_spaces'::regclass),
name character varying(80),
paid boolean,
spaces integer,
geometry geometry(Polygon,3857),
CONSTRAINT parking_spaces_pkey PRIMARY KEY (id)
)
-- CREATE SEQUENCE FOR TABLE parking_meters
CREATE SEQUENCE public.sq_parking_meters
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1;
-- TABLE parking_meter
CREATE TABLE public.parking_meters
(
id integer NOT NULL DEFAULT nextval('sq_parking_meters'::regclass),
name character varying(80),
geometry geometry(Point,3857),
CONSTRAINT parking_meters_pkey PRIMARY KEY (id)
)
What should be my next goal? How do I check the tables, using PgAdmin?
EDIT:
The question is how to properly connect PostgreSQL database to GeoServer? And how to give GeoServer full write access to layers?
In continuation to the links shared above, here are the generic steps to ensure that the configuration works well:
Create a new user (who doesn't necessarily have to be a superuser): https://www.postgresql.org/docs/9.1/static/app-createuser.html
GRANT
permissions for SELECT
, INSERT
, UPDATE
and DELETE
for this new user on your database: https://www.postgresql.org/docs/9.0/static/sql-grant.html
In the context of this particular problem, add Service Level Security for the application: http://docs.geoserver.org/stable/en/user/security/service.html
Ensure that you have the write access for the Layers. In loose terms, there will have to be one layer in Geoservices per table in the DB: http://docs.geoserver.org/stable/en/user/security/layer.html
Finally, when attempting to invoke WFS calls to the Services, the parameters in your jQuery must be set as described at the following link: https://gis.stackexchange.com/questions/21251/how-to-initialize-a-wfs-layer
Hope that helps.