Trouble with importing MultiPolygon, or perhaps the wrong query?

المشرف العام

Administrator
طاقم الإدارة
I have a MultiPolygon with 2 relatively simple polygons in it:http://microflush.org/json/MultiPolygon.json

I've pulled out the 2 polygons from the above MultiPolygon below, just to make sure they both exist (same url above, but different json):

json/upper.jsonjson/lower.json

Any/all of the 3 above can be copied/pasted into a GeoJSON tester to view them: http://geojsonlint.com/

I've stored the original MultiPolygon in PostgreSQL as below:

$ ogr2ogr -f "PostgreSQL" PG:"dbname=weatherzones user=postgres" "MultiPolygon.json" -nln polys

Here's how it looks in Postgres after the import:polytest=# \d polys; Table "public.polys" Column | Type | Modifiers
--------------+-------------------------+--------------------------------------------------------- ogc_fid | integer | not null default nextval('polys_ogc_fid_seq'::regclass) wkb_geometry | geometry(Geometry,4326) | warnings | character varying | Indexes: "polys_pk" PRIMARY KEY, btree (ogc_fid) "polys_geom_idx" gist (wkb_geometry)

polytest=#

When I try to query postgres using single points which lie in the lower polygon, I do not get rows returned. However, when I query using points which lie in the upper polygon, I get the row returned.

ie:

This point lies in the lower polygon, and this query returns no rows:

polytest=# select warnings from polys where ST_Intersects(ST_PointFromText('POINT( -116.024551 38.485773 )', 4326), wkb_geometry);

This next point lies in the upper polygon, and this query returns a row, which is the MultiPolygon:

polytest=# select warnings from polys where ST_Intersects(ST_PointFromText('POINT( -114.879913 39.249129 )', 4326), wkb_geometry);

Is there something wrong with my query, the way I imported the data, or perhaps the original MultiPolygon which can explain why a query with a point from the lower polygon won't return the MultiPolygon row? I've done this with other MultiPolygons and have not had an issue like this.Any help would be great.

Thanks!Joseph Spenner



أكثر...
 
أعلى