You are currently reviewing an older revision of this page.
Explanation:
If a View is not visible in Geospatial Administrator while registering the feature. The reason is View does not have Primary Key or Unique Constraint on a column. OpenCities Map requires a primary key or unique constraint on view. However, PostgreSQL does not allow to have a constraint on a View.Workaround:
Add an alias to primary key column while creating a view and it will be visible in Geospatial Administrator while registering features.
For an Example, let’s consider a table with SQL as:
CREATE TABLE public.road
(
gid integer NOT NULL Primary KEY,
name text,
geom geometry(linestring)
);
SQL for a View with alias ‘pkid’ for primary key column:
Create View road_view AS select gid as pkid, name, geom from public.road;