[postgis-users] Select polygons within polygon with PostGIS 2.0

Michal Zimmermann zimmicz at gmail.com
Thu Oct 11 03:10:34 PDT 2012


Sandro,
earlier you said
>One benefit is making the spatial relationships explicit, so that
> you could encode your counties as being composed by the districts,
> and the districts would be composed by faces, which would be defined
> by (shared) edges.
> At that point querying for "all districts in a county" would just be
> a matter of listing the components of a "county" TopoGeometry.

Does this mean it is better approach to have only one topology enabled
layer (in my case districts) with features having some id of which
county they belong to? In the end, I need to have county > districts >
cadastral areas chain (all of them being represented as polygons).
Right now I have both counties and districts layer with topology, but
I can't see a way to join them (e. g. to "select all districts from
counties where county.id = 1").

On 10/11/12, Michal Zimmermann <zimmicz at gmail.com> wrote:
> ALTER ROLE postgres IN DATABASE postgistemplate SET
> search_path="$user", public, topology; seems to do the magic.
>
> On 10/11/12, Sandro Santilli <strk at keybit.net> wrote:
>> On Thu, Oct 11, 2012 at 09:49:03AM +0200, Michal Zimmermann wrote:
>>> Got it! There was no username associated with the search_path and it
>>> seems that was causing the trouble.
>>
>> I don't understand it, can you please tell us more about how you fixed it
>> ?
>> The search_path `` "$user", public, topology `` seems sane to me.
>>
>> --strk;
>>
>>>
>>> On 10/11/12, Michal Zimmermann <zimmicz at gmail.com> wrote:
>>> > Variable search_path for postgistemplate DB has the following values:
>>> > "$user", public, topology.
>>> >
>>> > On 10/11/12, Michal Zimmermann <zimmicz at gmail.com> wrote:
>>> >> How do I find out?
>>> >>
>>> >> On 10/11/12, Sandro Santilli <strk at keybit.net> wrote:
>>> >>> On Thu, Oct 11, 2012 at 09:30:30AM +0200, Michal Zimmermann wrote:
>>> >>>> On 10/11/12, Sandro Santilli <strk at keybit.net> wrote:
>>> >>>> > On Thu, Oct 11, 2012 at 09:02:58AM +0200, Michal Zimmermann
>>> >>>> > wrote:
>>> >>>> >> Hi,
>>> >>>> >> I tried with SELECT CreateTopology('kraje_topo', 4326); and got
>>> >>>> >> the
>>> >>>> >> following error: ERROR: AddGeometryColumn() - invalid SRID. Is
>>> >>>> >> there
>>> >>>> >> something special I need to do before creating topology?
>>> >>>> >
>>> >>>> > The SRID must be in spatial_ref_sys.
>>> >>>> > Did you forget to load spatial_ref_sys.sql ?
>>> >>>>
>>> >>>> No, if I try select * from spatial_ref_sys where srid=4326, I get
>>> >>>> exactly one result. The topology table belongs to topology scheme,
>>> >>>> while the spatial_ref_sys belongs to public scheme, could that be a
>>> >>>> problem?
>>> >>>
>>> >>> Uhm, good question. Is "public" not in your search path ?
>>> >>>
>>> >>> --strk;
>>> >>>
>>> >>>  http://www.cartodb.com - Map, analyze and build applications with
>>> >>> your
>>> >>> data
>>> >>>
>>> >>>                                        ~~ http://strk.keybit.net
>>> >>>
>>> >>> _______________________________________________
>>> >>> postgis-users mailing list
>>> >>> postgis-users at postgis.refractions.net
>>> >>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>> >>>
>>> >>
>>> >>
>>> >> --
>>> >> Michal Zimmermann (zimmi)
>>> >> WWW: http://www.zimmi.cz
>>> >>
>>> >
>>> >
>>> > --
>>> > Michal Zimmermann (zimmi)
>>> > WWW: http://www.zimmi.cz
>>> >
>>>
>>>
>>> --
>>> Michal Zimmermann (zimmi)
>>> WWW: http://www.zimmi.cz
>>> _______________________________________________
>>> postgis-users mailing list
>>> postgis-users at postgis.refractions.net
>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>> --
>>
>>  http://www.cartodb.com - Map, analyze and build applications with your
>> data
>>
>>                                        ~~ http://strk.keybit.net
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>
>
> --
> Michal Zimmermann (zimmi)
> WWW: http://www.zimmi.cz
>


-- 
Michal Zimmermann (zimmi)
WWW: http://www.zimmi.cz



More information about the postgis-users mailing list