[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    Re: [postgis-users] Trouble with returning MultiPolygon on psql query
From:       Birgit Laggner <birgit.laggner () ti ! bund ! de>
Date:       2015-09-17 12:31:43
Message-ID: 55FAB2AF.10604 () ti ! bund ! de
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi Joseph,

I tried your intersects query after creating the multipolygon using the 
st_geomfromtext function with the coordinates from your geojson objects. 
There were no problems with the intersects query. The query returned a 
result even with the point within the lower polygon.

So my question would be: Are you sure, you did import all multipolygon 
parts in postgres? If you can't visualize the PostGIS geometries, 
perhaps you could dump the multipolygon in question to single polygons 
and compare the resulting number with the original as a first approach?

Regards,

Birgit


Am 12.09.2015 um 19:29 schrieb Joseph Spenner:
> I believe I may have overcomplicated my question.  My apologies.  I've 
> come up with a much simpler explanation of the issue:
>
> I have a MultiPolygon with 2 relatively simple polygons in it:
>
> http://microflush.org/json/MultiPolygon.json 
> <http://microflush.org/json/24.json>
>
>
> I've pulled out the 2 polygons from the above MultiPolygon below:
>
> http://microflush.org/json/upper.json
>
> http://microflush.org/json/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 described in my 
> original post:
>
> $ 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, 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
>
>
>
>
>
> ------------------------------------------------------------------------
> *From:* Joseph Spenner <joseph85750@yahoo.com>
> *To:* PostGIS Users Discussion <postgis-users@lists.osgeo.org>
> *Sent:* Wednesday, September 9, 2015 12:10 PM
> *Subject:* Trouble with returning MultiPolygon on psql query
>
> Hello, I have a file (source.json) containing 25 GeoJSON polygons with 
> weather alerts, which I imported into postgres using the following 
> command:
>
> $ ogr2ogr -f "PostgreSQL" PG:"dbname=weatherzones user=postgres" 
> "source.json" -nln polys
>
> Here's how it looks in Postgres:
>
> 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=#
>
> I can see it stored all of them:
>
> polytest=# select count(*) from polys;
>  count
> -------
>     25
> (1 row)
>
> polytest=#
>
> However, when I try to use a ST_Intersects(ST_PointFromText('POINT(), 
> I can't seem to get lines with MultiPolygons to return rows.  The 
> regular Polygons seem to work fine, though.
>
> For example, I have the following MultiPolygon in my table from Nevada:
> http://microflush.org/json/24.json
>
> Using a validator site, such as http://geojsonlint.com/ , I can 
> copy/paste that JSON into the interface and it looks like 2 adjacent 
> shapes making up the MultiPolygon.
>
> If I grab points from the upper section of the polygon, using 
> something like http://itouchmap.com/latlong.html, I get rows returned:
> polytest=# select warnings from polys where 
> ST_Intersects(ST_PointFromText('POINT( -114.543457 39.336281 )', 
> 4326), wkb_geometry) limit 2;
> polytest=# select warnings from polys where 
> ST_Intersects(ST_PointFromText('POINT( -115.658569 39.500297 )', 
> 4326), wkb_geometry) limit 2;
>
> But if I use a point from the lower Polygon section of that 
> MultiPolygon, I get zero:
>
> polytest=# select warnings from polys where 
> ST_Intersects(ST_PointFromText('POINT( -115.977173 38.548667 )', 
> 4326), wkb_geometry) limit 2;
>
>
>
> Another example from Florida (a little more difficult to see, but same 
> issue):
> http://microflush.org/json/06.json
>
> polytest=# select warnings from polys where 
> ST_Intersects(ST_PointFromText('POINT( -81.988228 27.034561 )', 4326), 
> wkb_geometry) limit 2;
>
> warnings
> ----------
> (0 rows)
>
> The above point (-81.988228 27.034561) would spacially exist in this 
> MultiPolygon.
>
>
> However, in this example, it will only return rows if I pick a point 
> inside the little polygon which shows up focused to the south of the 
> much larger polygon (when you use the geojsonlin.com site to plot the 
> whole thing).  For example, this point:
>
> polytest=# select warnings from polys where 
> ST_Intersects(ST_PointFromText('POINT( -81.9878 27.034 )', 4326), 
> wkb_geometry) limit 2;
> (1 row)
>
> So, it would seem the select statements which should return 
> Multipolygons are not returning for all Polygons contained in the 
> MultiPolygon.
>
> Is there something I'm doing incorrectly with my queries?
>
> Any help would be great.
>
> Thank you!
>
> Joseph Spenner
>
>
>
>
>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users@lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users


[Attachment #5 (text/html)]

<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Joseph,<br>
    <br>
    I tried your intersects query after creating the multipolygon using
    the st_geomfromtext function with the coordinates from your geojson
    objects. There were no problems with the intersects query. The query
    returned a result even with the point within the lower polygon.<br>
    <br>
    So my question would be: Are you sure, you did import all
    multipolygon parts in postgres? If you can't visualize the PostGIS
    geometries, perhaps you could dump the multipolygon in question to
    single polygons and compare the resulting number with the original
    as a first approach?<br>
    <br>
    Regards,<br>
    <br>
    Birgit<br>
    <br>
    <br>
    <div class="moz-cite-prefix">Am 12.09.2015 um 19:29 schrieb Joseph
      Spenner:<br>
    </div>
    <blockquote
      cite="mid:977537324.1537109.1442078967621.JavaMail.yahoo@mail.yahoo.com"
      type="cite">
      <div style="color:#000; background-color:#fff; font-family:times
        new roman, new york, times, serif;font-size:16px">
        <div id="yiv8252287767">
          <div id="yui_3_16_0_1_1442077175700_9054">
            <div id="yui_3_16_0_1_1442077175700_9053"
              style="color:#000;background-color:#fff;font-family:times
              new roman, new york, times, serif;font-size:16px;">
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_9975"><span
                  id="yiv8252287767yui_3_16_0_1_1441984706956_10072">I
                  believe I may have overcomplicated my question.  My
                  apologies.  I've come up with a much simpler
                  explanation of the issue:</span></div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10073"><br
                  clear="none">
                <span></span></div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10075"><span
                  id="yiv8252287767yui_3_16_0_1_1441984706956_10074">I
                  have a MultiPolygon with 2 relatively simple polygons
                  in it:</span></div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10076"><br
                  clear="none">
                <span></span></div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10077"><span
                  id="yiv8252287767yui_3_16_0_1_1441984706956_10078"><a
                    moz-do-not-send="true" rel="nofollow" shape="rect"
                    id="yiv8252287767yui_3_16_0_1_1441984706956_10079"
                    target="_blank"
                    href="http://microflush.org/json/24.json">http://microflush.org/json/MultiPolygon.json</a></span></div>
  <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10086"><br
                  clear="none">
                <span \
id="yiv8252287767yui_3_16_0_1_1441984706956_10078"></span></div>  <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10186">
                <div id="yui_3_16_0_1_1442077175700_9512"><br>
                </div>
                <div id="yui_3_16_0_1_1442077175700_9513">I've pulled
                  out the 2 polygons from the above MultiPolygon below:<br>
                </div>
              </div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10256"><br
                  clear="none">
                <span \
id="yiv8252287767yui_3_16_0_1_1441984706956_10078"></span></div>  <div \
id="yui_3_16_0_1_1442077175700_9251" dir="ltr"><a  moz-do-not-send="true"
                  id="yui_3_16_0_1_1442077175700_9249"
                  href="http://microflush.org/json/upper.json">http://microflush.org/json/upper.json</a></div>
  <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10467"><br
                  clear="none">
                <span \
id="yiv8252287767yui_3_16_0_1_1441984706956_10078"></span></div>  <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10468">
                <div id="yui_3_16_0_1_1442077175700_9328" dir="ltr"><span
                    id="yiv8252287767yui_3_16_0_1_1441984706956_10078"><a
                      moz-do-not-send="true"
                      id="yui_3_16_0_1_1442077175700_9326"
                      \
href="http://microflush.org/json/lower.json">http://microflush.org/json/lower.json</a></span></div>
  </div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10469">
                <div id="yui_3_16_0_1_1442077175700_10117"><br>
                </div>
                <div id="yui_3_16_0_1_1442077175700_10236">Any/all of
                  the 3 above can be copied/pasted into a GeoJSON tester
                  to view them:</div>
                <div id="yui_3_16_0_1_1442077175700_10237" dir="ltr">   
                  <a moz-do-not-send="true" class="" rel="nofollow"
                    shape="rect"
                    id="yiv8252287767yui_3_16_0_1_1441815105712_44533"
                    target="_blank" \
href="http://geojsonlint.com/">http://geojsonlint.com/</a></div>  <div \
id="yui_3_16_0_1_1442077175700_10238" dir="ltr"><br>  </div>
                <div id="yui_3_16_0_1_1442077175700_10239" dir="ltr"><br>
                  <span
                    id="yiv8252287767yui_3_16_0_1_1441984706956_10078"></span></div>
              </div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10470">
                <div id="yui_3_16_0_1_1442077175700_9608"><span
                    id="yiv8252287767yui_3_16_0_1_1441984706956_10078">I've
                    stored the original MultiPolygon in PostgreSQL as
                    described in my original post:</span></div>
                <div id="yui_3_16_0_1_1442077175700_10318"><br>
                  <span
                    id="yiv8252287767yui_3_16_0_1_1441984706956_10078"></span></div>
                <div class="" dir="ltr"
                  id="yiv8252287767yui_3_16_0_1_1441815105712_28071">
                  <div id="yui_3_16_0_1_1442077175700_10631" dir="ltr"><font
                      class=""
                      id="yiv8252287767yui_3_16_0_1_1441815105712_45029"
                      face="Courier New, courier, monaco, monospace,
                      sans-serif">$ ogr2ogr -f "PostgreSQL"
                      PG:"dbname=weatherzones user=postgres"
                      "MultiPolygon.json" -nln polys</font></div>
                  <br class="" id="yui_3_16_0_1_1442077175700_9613"
                    clear="none">
                </div>
                <div class=""
                  id="yiv8252287767yui_3_16_0_1_1441815105712_31057">Here's
                  how it looks in Postgres after the import:</div>
                <div class=""
                  id="yiv8252287767yui_3_16_0_1_1441815105712_31104"><br
                    class="" id="yui_3_16_0_1_1442077175700_9617"
                    clear="none">
                </div>
                <div class="" dir="ltr"
                  id="yiv8252287767yui_3_16_0_1_1441815105712_31179"><font
                    class=""
                    id="yiv8252287767yui_3_16_0_1_1441815105712_31369"
                    face="Courier New, courier, monaco, monospace,
                    sans-serif">polytest=# \d polys;<br class=""
                      id="yiv8252287767yui_3_16_0_1_1441815105712_31182"
                      clear="none">
                                                           Table
                    "public.polys"<br class=""
                      id="yiv8252287767yui_3_16_0_1_1441815105712_31184"
                      clear="none">
                        Column    |          Type          
                    |                       
                    Modifiers                        <br class=""
                      id="yiv8252287767yui_3_16_0_1_1441815105712_31186"
                      clear="none">
--------------+-------------------------+---------------------------------------------------------<br
  class=""
                      id="yiv8252287767yui_3_16_0_1_1441815105712_31188"
                      clear="none">
                     ogc_fid      | integer                 | not null
                    default nextval('polys_ogc_fid_seq'::regclass)<br
                      class=""
                      id="yiv8252287767yui_3_16_0_1_1441815105712_31190"
                      clear="none">
                     wkb_geometry | geometry(Geometry,4326) | <br
                      class=""
                      id="yiv8252287767yui_3_16_0_1_1441815105712_31192"
                      clear="none">
                     warnings     | character varying       | <br
                      class=""
                      id="yiv8252287767yui_3_16_0_1_1441815105712_31194"
                      clear="none">
                    Indexes:<br class=""
                      id="yiv8252287767yui_3_16_0_1_1441815105712_31196"
                      clear="none">
                        "polys_pk" PRIMARY KEY, btree (ogc_fid)<br
                      class=""
                      id="yiv8252287767yui_3_16_0_1_1441815105712_31198"
                      clear="none">
                        "polys_geom_idx" gist (wkb_geometry)<br class=""
                      id="yiv8252287767yui_3_16_0_1_1441815105712_31200"
                      clear="none">
                    <br class=""
                      id="yiv8252287767yui_3_16_0_1_1441815105712_31202"
                      clear="none">
                    polytest=# </font><br class=""
                    id="yui_3_16_0_1_1442077175700_9632" clear="none">
                </div>
                <div class=""
                  id="yiv8252287767yui_3_16_0_1_1441815105712_27941"><br
                    class="" id="yui_3_16_0_1_1442077175700_9635"
                    clear="none">
                  <span class=""
                    id="yiv8252287767yui_3_16_0_1_1441815105712_31076"></span></div>
              </div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10473"><br
                  clear="none">
                <span \
id="yiv8252287767yui_3_16_0_1_1441984706956_10078"></span></div>  <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10474"><span
                  id="yiv8252287767yui_3_16_0_1_1441984706956_10078">When
                  I try to query postgres using single points which lie
                  in the lower polygon, I do not get rows returned.</span></div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10475"><span
                  id="yiv8252287767yui_3_16_0_1_1441984706956_10078">However,
                  when I query using points which lie in the upper
                  polygon, I get the row returned.</span></div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10476">
                <div id="yui_3_16_0_1_1442077175700_10983"><br>
                </div>
                <div id="yui_3_16_0_1_1442077175700_11060">ie:</div>
                <div id="yui_3_16_0_1_1442077175700_11061"><br
                    clear="none">
                </div>
              </div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10499">This
                point lies in the lower polygon, and this query returns
                no rows:</div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10517"><br
                  clear="none">
              </div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10518"><font
                  id="yiv8252287767yui_3_16_0_1_1441984706956_10846"
                  face="Courier New, courier, monaco, monospace,
                  sans-serif">polytest=# select warnings from polys
                  where ST_Intersects(ST_PointFromText('POINT(
                  -116.024551 38.485773 )', 4326), wkb_geometry); </font><br
                  class="yiv8252287767"
                  id="yiv8252287767yui_3_16_0_1_1441984706956_10520"
                  clear="none">
              </div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10539"><br
                  clear="none">
              </div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10538"><br
                  clear="none">
              </div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10607">This
                next point lies in the upper polygon, and this query
                returns a row, which is the MultiPolygon:</div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10566"><br
                  clear="none">
              </div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10608"><font
                  id="yiv8252287767yui_3_16_0_1_1441984706956_10835"
                  face="Courier New, courier, monaco, monospace,
                  sans-serif">polytest=# select warnings from polys
                  where ST_Intersects(ST_PointFromText('POINT(
                  -114.879913 39.249129 )', 4326), wkb_geometry); </font><br
                  class="yiv8252287767"
                  id="yiv8252287767yui_3_16_0_1_1441984706956_10611"
                  clear="none">
              </div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10612"><br
                  clear="none">
              </div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10700">Is
                there something wrong with my query, 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.</div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10816"><br
                  clear="none">
              </div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10817">Any
                help would be great.</div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10884"><br
                  clear="none">
              </div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10885">Thanks!</div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10886"><br
                  clear="none">
              </div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10887">Joseph
                Spenner</div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10890"><br
                  clear="none">
              </div>
              <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10618"><br
                  clear="none">
                <span \
id="yiv8252287767yui_3_16_0_1_1441984706956_10078"></span></div>  <div dir="ltr"
                id="yiv8252287767yui_3_16_0_1_1441984706956_10159"><span
                  id="yiv8252287767yui_3_16_0_1_1441984706956_10078"></span><br
                  clear="none">
              </div>
              <div class="qtdSeparateBR"><br>
                <br>
              </div>
              <div class="yiv8252287767yqt9673984061"
                id="yiv8252287767yqt88601">
                <div id="yiv8252287767yui_3_16_0_1_1441984706956_10163"
                  style="font-family:times new roman, new york, times,
                  serif;font-size:16px;">
                  <div
                    id="yiv8252287767yui_3_16_0_1_1441984706956_10162"
                    style="font-family:HelveticaNeue, Helvetica Neue,
                    Helvetica, Arial, Lucida Grande,
                    sans-serif;font-size:16px;">
                    <div dir="ltr"
                      id="yiv8252287767yui_3_16_0_1_1441984706956_10161">
                      <hr
                        id="yiv8252287767yui_3_16_0_1_1441984706956_10160"
                        size="1"> <font
                        id="yiv8252287767yui_3_16_0_1_1441984706956_10516"
                        face="Arial" size="2"> <b><span
                            style="font-weight:bold;">From:</span></b>
                        Joseph Spenner <a class="moz-txt-link-rfc2396E" \
href="mailto:joseph85750@yahoo.com">&lt;joseph85750@yahoo.com&gt;</a><br  \
clear="none">  <b><span style="font-weight:bold;">To:</span></b>
                        PostGIS Users Discussion
                        <a class="moz-txt-link-rfc2396E" \
href="mailto:postgis-users@lists.osgeo.org">&lt;postgis-users@lists.osgeo.org&gt;</a> \
<br  clear="none">
                        <b><span style="font-weight:bold;">Sent:</span></b>
                        Wednesday, September 9, 2015 12:10 PM<br
                          clear="none">
                        <b><span style="font-weight:bold;">Subject:</span></b>
                        Trouble with returning MultiPolygon on psql
                        query<br clear="none">
                      </font> </div>
                    <div class="yiv8252287767y_msg_container"
                      id="yiv8252287767yui_3_16_0_1_1441984706956_10839"><br
                        clear="none">
                      <div id="yiv8252287767">
                        <div
                          id="yiv8252287767yui_3_16_0_1_1441984706956_10842">
                          <div
                            id="yiv8252287767yui_3_16_0_1_1441984706956_10841"
                            style="color:#000;background-color:#fff;font-family:times
                            new roman, new york, times,
                            serif;font-size:16px;">
                            <div
                              \
id="yiv8252287767yui_3_16_0_1_1441815105712_28073">Hello,  I have a file \
(source.json) containing 25  GeoJSON polygons with weather alerts,
                              which I imported into postgres using the
                              following command:</div>
                            <div
                              id="yiv8252287767yui_3_16_0_1_1441815105712_28072"><br
                                clear="none">
                            </div>
                            <div dir="ltr"
                              \
id="yiv8252287767yui_3_16_0_1_1441815105712_28071"><font \
id="yiv8252287767yui_3_16_0_1_1441815105712_45029" face="Courier New,  courier, \
monaco, monospace, sans-serif">$  ogr2ogr -f "PostgreSQL"
                                PG:"dbname=weatherzones user=postgres"
                                "source.json" -nln polys</font><br
                                class="yiv8252287767"
                                id="yiv8252287767yui_3_16_0_1_1441815105712_31079"
                                clear="none">
                              <br clear="none">
                            </div>
                            <div
                              \
id="yiv8252287767yui_3_16_0_1_1441815105712_31057">Here's  how it looks in \
Postgres:</div>  <div
                              id="yiv8252287767yui_3_16_0_1_1441815105712_31104"><br
                                clear="none">
                            </div>
                            <div dir="ltr"
                              \
id="yiv8252287767yui_3_16_0_1_1441815105712_31179"><font \
                id="yiv8252287767yui_3_16_0_1_1441815105712_31369" face="Courier New,
                                courier, monaco, monospace, sans-serif">polytest=#
                                \d polys;<br class="yiv8252287767"
                                  id="yiv8252287767yui_3_16_0_1_1441815105712_31182"
                                  clear="none">
                                                                      
                                Table "public.polys"<br
                                  class="yiv8252287767"
                                  id="yiv8252287767yui_3_16_0_1_1441815105712_31184"
                                  clear="none">
                                    Column    |          Type          
                                |                       
                                Modifiers                        <br
                                  class="yiv8252287767"
                                  id="yiv8252287767yui_3_16_0_1_1441815105712_31186"
                                  clear="none">
--------------+-------------------------+---------------------------------------------------------<br
  class="yiv8252287767"
                                  id="yiv8252287767yui_3_16_0_1_1441815105712_31188"
                                  clear="none">
                                 ogc_fid      | integer                
                                | not null default
                                nextval('polys_ogc_fid_seq'::regclass)<br
                                  class="yiv8252287767"
                                  id="yiv8252287767yui_3_16_0_1_1441815105712_31190"
                                  clear="none">
                                 wkb_geometry | geometry(Geometry,4326)
                                | <br class="yiv8252287767"
                                  id="yiv8252287767yui_3_16_0_1_1441815105712_31192"
                                  clear="none">
                                 warnings     | character varying      
                                | <br class="yiv8252287767"
                                  id="yiv8252287767yui_3_16_0_1_1441815105712_31194"
                                  clear="none">
                                Indexes:<br class="yiv8252287767"
                                  id="yiv8252287767yui_3_16_0_1_1441815105712_31196"
                                  clear="none">
                                    "polys_pk" PRIMARY KEY, btree
                                (ogc_fid)<br class="yiv8252287767"
                                  id="yiv8252287767yui_3_16_0_1_1441815105712_31198"
                                  clear="none">
                                    "polys_geom_idx" gist (wkb_geometry)<br
                                  class="yiv8252287767"
                                  id="yiv8252287767yui_3_16_0_1_1441815105712_31200"
                                  clear="none">
                                <br class="yiv8252287767"
                                  id="yiv8252287767yui_3_16_0_1_1441815105712_31202"
                                  clear="none">
                                polytest=# </font><br clear="none">
                            </div>
                            <div
                              id="yiv8252287767yui_3_16_0_1_1441815105712_27941"><br
                                clear="none">
                              <span
                                \
id="yiv8252287767yui_3_16_0_1_1441815105712_31076"></span></div>  <div
                              \
id="yiv8252287767yui_3_16_0_1_1441815105712_31368"><span \
id="yiv8252287767yui_3_16_0_1_1441815105712_31076">I can see it stored  all of \
them:</span></div>  <div
                              id="yiv8252287767yui_3_16_0_1_1441815105712_31367"><br
                                clear="none">
                              <span
                                \
id="yiv8252287767yui_3_16_0_1_1441815105712_31076"></span></div>  <div dir="ltr"
                              \
id="yiv8252287767yui_3_16_0_1_1441815105712_31349"><font \
                id="yiv8252287767yui_3_16_0_1_1441815105712_37798" face="Courier New,
                                courier, monaco, monospace, sans-serif"><span
id="yiv8252287767yui_3_16_0_1_1441815105712_31076">polytest=# select
                                  count(*) from polys;<br
                                    class="yiv8252287767"
                                    \
id="yiv8252287767yui_3_16_0_1_1441815105712_31352"  clear="none">
                                   count <br class="yiv8252287767"
                                    \
id="yiv8252287767yui_3_16_0_1_1441815105712_31354"  clear="none">
                                  -------<br class="yiv8252287767"
                                    \
id="yiv8252287767yui_3_16_0_1_1441815105712_31356"  clear="none">
                                      25<br class="yiv8252287767"
                                    \
id="yiv8252287767yui_3_16_0_1_1441815105712_31358"  clear="none">
                                  (1 row)<br class="yiv8252287767"
                                    \
id="yiv8252287767yui_3_16_0_1_1441815105712_31360"  clear="none">
                                  <br class="yiv8252287767"
                                    \
id="yiv8252287767yui_3_16_0_1_1441815105712_31362"  clear="none">
                                  polytest=# </span></font></div>
                            <div dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_44322"><br
                                clear="none">
                            </div>
                            <div dir="ltr"
                              \
id="yiv8252287767yui_3_16_0_1_1441815105712_31400">However,  when I try to use a
                              ST_Intersects(ST_PointFromText('POINT(), I
                              can't seem to get lines with MultiPolygons
                              to return rows.  The regular Polygons seem
                              to work fine, though.</div>
                            <br clear="none">
                            <div dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_37949">For
                              example, I have the following MultiPolygon
                              in my table from Nevada: <br clear="none">
                            </div>
                            <div dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_37950"><a
                                moz-do-not-send="true" rel="nofollow"
                                shape="rect"
                                id="yiv8252287767yui_3_16_0_1_1441815105712_37983"
                                target="_blank"
                                \
href="http://microflush.org/json/24.json">http://microflush.org/json/24.json</a></div>
  <div dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_37988"><br
                                clear="none">
                            </div>
                            <div dir="ltr"
                              \
id="yiv8252287767yui_3_16_0_1_1441815105712_44485">Using  a validator site, such as \
<a  moz-do-not-send="true" rel="nofollow"
                                shape="rect"
                                id="yiv8252287767yui_3_16_0_1_1441815105712_44533"
                                target="_blank"
                                \
href="http://geojsonlint.com/">http://geojsonlint.com/</a>  , I can copy/paste that \
JSON into the  interface and it looks like 2 adjacent
                              shapes making up the MultiPolygon.</div>
                            <div dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_41137"><br
                                clear="none">
                            </div>
                            <div dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_44587">If
                              I grab points from the upper section of
                              the polygon, using something like <a
                                moz-do-not-send="true" rel="nofollow"
                                shape="rect"
                                id="yiv8252287767yui_3_16_0_1_1441815105712_44588"
                                target="_blank"
                                \
href="http://itouchmap.com/latlong.html">http://itouchmap.com/latlong.html</a>,  I \
get rows returned:</div>  <div dir="ltr"
                              \
id="yiv8252287767yui_3_16_0_1_1441815105712_41153">polytest=#  select warnings from \
polys where  ST_Intersects(ST_PointFromText('POINT(
                              -114.543457 39.336281 )', 4326),
                              wkb_geometry) limit 2; <br clear="none">
                            </div>
                            <div dir="ltr"
                              \
id="yiv8252287767yui_3_16_0_1_1441815105712_41170">polytest=#  select warnings from \
polys where  ST_Intersects(ST_PointFromText('POINT(
                              -115.658569 39.500297 )', 4326),
                              wkb_geometry) limit 2; <br clear="none">
                            </div>
                            <div dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_41187"><br
                                clear="none">
                            </div>
                            <div dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_41237">But
                              if I use a point from the lower Polygon
                              section of that MultiPolygon, I get zero:<br
                                clear="none">
                            </div>
                            <div dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_41038"><br
                                clear="none">
                            </div>
                            <div dir="ltr"
                              \
id="yiv8252287767yui_3_16_0_1_1441815105712_41094"><font \
                id="yiv8252287767yui_3_16_0_1_1441815105712_44739" face="Courier New,
                                courier, monaco, monospace, sans-serif">polytest=#
                                select warnings from polys where
                                ST_Intersects(ST_PointFromText('POINT(
                                -115.977173 38.548667 )', 4326),
                                wkb_geometry) limit 2; </font><br
                                class="yiv8252287767"
                                id="yiv8252287767yui_3_16_0_1_1441815105712_41071"
                                clear="none">
                            </div>
                            <div dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_41072"><br
                                clear="none">
                            </div>
                            <div dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_41074"><br
                                clear="none">
                            </div>
                            <div dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_44719"><br
                                clear="none">
                            </div>
                            <div dir="ltr"
                              \
id="yiv8252287767yui_3_16_0_1_1441815105712_44436">Another  example from Florida (a \
little more  difficult to see, but same issue):</div>
                            <div class="yiv8252287767" dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_31748"><a
                                moz-do-not-send="true" rel="nofollow"
                                shape="rect" class="yiv8252287767"
                                id="yiv8252287767yui_3_16_0_1_1441815105712_31767"
                                target="_blank"
                                \
href="http://microflush.org/json/06.json">http://microflush.org/json/06.json</a></div>
  <div dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_44467"><br
                                clear="none">
                            </div>
                            <div class="yiv8252287767" dir="ltr"
                              \
id="yiv8252287767yui_3_16_0_1_1441815105712_31462"><font \
                id="yiv8252287767yui_3_16_0_1_1441815105712_44717" face="Courier New,
                                courier, monaco, monospace, sans-serif">polytest=#

                                select warnings from polys where
                                ST_Intersects(ST_PointFromText('POINT(
                                -81.988228 27.034561 )', 4326),
                                wkb_geometry) limit 2;</font><br
                                class="yiv8252287767"
                                id="yiv8252287767yui_3_16_0_1_1441815105712_31597"
                                clear="none">
                              <font face="Courier New, courier, monaco,
                                monospace, sans-serif"><br
                                  class="yiv8252287767"
                                  id="yiv8252287767yui_3_16_0_1_1441815105712_44440"
                                  clear="none">
                                <span class="yiv8252287767"
                                  \
id="yiv8252287767yui_3_16_0_1_1441815105712_31076"></span></font></div>  <div \
                class="yiv8252287767" dir="ltr"
                              \
id="yiv8252287767yui_3_16_0_1_1441815105712_31377"><span  class="yiv8252287767"
                                \
id="yiv8252287767yui_3_16_0_1_1441815105712_31076"><font \
id="yiv8252287767yui_3_16_0_1_1441815105712_45028" face="Courier New,  courier, \
monaco, monospace,  sans-serif">warnings <br
                                    class="yiv8252287767"
                                    \
id="yiv8252287767yui_3_16_0_1_1441815105712_31627"  clear="none">
                                  ----------<br class="yiv8252287767"
                                    \
id="yiv8252287767yui_3_16_0_1_1441815105712_31629"  clear="none">
                                  (0 rows)</font><br
                                  class="yiv8252287767"
                                  id="yiv8252287767yui_3_16_0_1_1441815105712_31631"
                                  clear="none">
                              </span></div>
                            <div class="yiv8252287767" dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_31633"><br
                                class="yiv8252287767"
                                id="yiv8252287767yui_3_16_0_1_1441815105712_44449"
                                clear="none">
                            </div>
                            <div class="yiv8252287767" dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_31733">The
                              above point (-81.988228 27.034561) would
                              spacially exist in this MultiPolygon.</div>
                            <br clear="none">
                            <div class="yiv8252287767" dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_44419"><br
                                class="yiv8252287767"
                                id="yiv8252287767yui_3_16_0_1_1441815105712_44461"
                                clear="none">
                            </div>
                            <div class="yiv8252287767" dir="ltr"
                              \
id="yiv8252287767yui_3_16_0_1_1441815105712_44420">However,

                              in this example, it will only return rows
                              if I pick a point inside the little
                              polygon which shows up focused to the
                              south of the much larger polygon (when you
                              use the geojsonlin.com site to plot the
                              whole thing).  For example, this point:</div>
                            <div class="yiv8252287767" dir="ltr"
                              \
id="yiv8252287767yui_3_16_0_1_1441815105712_37799"><font  face="Courier New, courier, \
monaco,  monospace, sans-serif"><br
                                  class="yiv8252287767"
                                  id="yiv8252287767yui_3_16_0_1_1441815105712_44465"
                                  clear="none">
                              </font></div>
                            <div class="yiv8252287767" dir="ltr"
                              \
id="yiv8252287767yui_3_16_0_1_1441815105712_37809"><font \
                id="yiv8252287767yui_3_16_0_1_1441815105712_45025" face="Courier New,
                                courier, monaco, monospace, sans-serif">polytest=#

                                select warnings from polys where
                                ST_Intersects(ST_PointFromText('POINT(
                                -81.9878 27.034 )', 4326), wkb_geometry)
                                limit 2;</font></div>
                            <div dir="ltr"
                              \
id="yiv8252287767yui_3_16_0_1_1441815105712_44868"><font  face="Courier New, courier, \
                monaco,
                                monospace, sans-serif">(1 row)</font></div>
                            <div dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_41136"><br
                                clear="none">
                            </div>
                            <div dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_44869">So,
                              it would seem the select statements which
                              should return Multipolygons are not
                              returning for all Polygons contained in
                              the MultiPolygon.</div>
                            <div dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_44870"><br
                                clear="none">
                            </div>
                            <div dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_44871">Is
                              there something I'm doing incorrectly with
                              my queries?</div>
                            <div dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_44872"><br
                                clear="none">
                            </div>
                            <div dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_44873">Any
                              help would be great.</div>
                            <div dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_44874"><br
                                clear="none">
                            </div>
                            <div dir="ltr"
                              \
id="yiv8252287767yui_3_16_0_1_1441815105712_44875">Thank  you!</div>
                            <div dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_44876"><br
                                clear="none">
                            </div>
                            <div dir="ltr"
                              \
id="yiv8252287767yui_3_16_0_1_1441815105712_44877">Joseph  Spenner</div>
                            <div dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_44878"><br
                                clear="none">
                            </div>
                            <div dir="ltr"
                              id="yiv8252287767yui_3_16_0_1_1441815105712_31735"><br
                                clear="none">
                              <span
                                \
id="yiv8252287767yui_3_16_0_1_1441815105712_31076"></span></div>  <br clear="none">
                          </div>
                        </div>
                      </div>
                      <br clear="none">
                      <br clear="none">
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
postgis-users mailing list
<a class="moz-txt-link-abbreviated" \
href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a> <a \
class="moz-txt-link-freetext" \
href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a></pre>
  </blockquote>
    <br>
  </body>
</html>



_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic