1

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?

10
  • Are you able to run a PHP code yet? Please check homeandlearn.co.uk/php/php1p3.html and stackoverflow.com/questions/14621181/… Commented Jan 16, 2017 at 20:39
  • Hello, yes I'm able to do that. I access it via localhost/GEO (its the folder in /www) and I can already draw on the map, but after I reload it, everything is gone, and I think that the coordinates were not being saved into database. Commented Jan 16, 2017 at 20:46
  • Ok, thanks for confirming. You mentioned that the code was downloaded from somewhere. Has it been configured according to the credentials of your DB user's access? It's hard to guess but, if not already configured, then it could be in the "config" folder or a file of the similar name in your project? Commented Jan 16, 2017 at 20:55
  • Hmm, I can't seem to find database credentials anywhere in the code. The project has "database" folder with database.sql file, "php" folder with kml.php file ( I think that it is used for uploading KML files ), "css" folder with .css files, and "js" folder with jquery,openlayer and main script ( in that main script I couldn't find any refference to database, but the code is complicated and I might have missed it somehow). Do you want any of these files uploaded? Commented Jan 16, 2017 at 21:06
  • Do you find any configuration instructions on the source you downloaded the code from? Is there a README document with the code package? Your application needs to know where it resides and what credentials to use to be able to access the DB. Also, please do try inserting the data manually in the tables and run SELECT queries to make sure your DB is actually working? Are you able to use phpPgAdmin? If not, please see this answer from the second link in the first comment: stackoverflow.com/a/18804253/2298301 Commented Jan 16, 2017 at 21:23

2 Answers 2

1

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

Hope that helps.

Sign up to request clarification or add additional context in comments.

Comments

1

From your commands above it doesn't appear as if you have added the geometry column to the geometry_columns table - use the AddGeometryColumn statement to do this.

The next thing to try is to work through the GeoServer tutorial on PostGIS.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.