Search code examples
phppostgresqlpostgisgeoserverpgadmin

PostgreSQL database doesn't seem to work with GeoServer


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?


Solution

  • In continuation to the links shared above, here are the generic steps to ensure that the configuration works well:

    Hope that helps.