[mapguide-users] Sql For Data Filter

Luiz Marcio Viana lmarcio at pars.com.br
Thu Jan 3 07:12:00 EST 2008


I think is possible to put a spatial query in the <Filter> tag of the layer definition, but this is high dependent of the database. 
And I don't know if the time to process this query is more complex than filter using the ids of the parcels.

But to solve this problem, you can make a spatial query using SelectFeatures and get the ids of parcels and follow make the filter using the ids.

Regards,
Luiz Marcio
  ----- Original Message ----- 
  From: ary sucaya 
  To: MapGuide Users Mail List 
  Sent: Wednesday, January 02, 2008 6:41 PM
  Subject: Re: [mapguide-users] Sql For Data Filter


  I got it, as Kenneth said:

  $node->nodeValue = the_geom intersects(GEOMFROMTEXT('POLYGON((x1 y1,x2 y1,x2 y2,x1 y1,x1 y1))')";)

  Regards,

  Ary Sucaya


  ----- Original Message ----
  From: ary sucaya <ary.sucaya at yahoo.com>
  To: MapGuide Users Mail List <mapguide-users at lists.osgeo.org>
  Sent: Wednesday, January 2, 2008 9:51:21 PM
  Subject: Re: [mapguide-users] Sql For Data Filter


  Luiz,

  Maybe you're right Luiz. But still i found difficulties to apply a spatial filter for those parcels. Here is how i made a filter to select parcels owned by SCH*:

  $xpath = new DOMXPath($domDocument); 
  $query = '//VectorLayerDefinition/Filter'; 
  $nodes = $xpath->query($query); 

  foreach ($nodes as $node ) 
  { 
     $node->nodeValue = "NAME LIKE 'SCH%'"; 
  }

  My question is how to apply spatial filter into this node value?


  Regards,

  Ary Sucaya



   
  ----- Original Message ----
  From: Luiz Marcio Viana <lmarcio at pars.com.br>
  To: MapGuide Users Mail List <mapguide-users at lists.osgeo.org>
  Sent: Wednesday, January 2, 2008 4:33:30 PM
  Subject: Re: [mapguide-users] Sql For Data Filter


  Ary Sucaya,

  I don't know, how is the spatial capability provided by the FDO Provider for PostGIS (I think is the GDAL provider, isn't it?), but you can apply a spatial filter using the geometry of the district layer as a filter to select the parcels.

  This is a simple solution wich works almost independently of the provider.

  Regards,
  Luiz Marcio
    ----- Original Message ----- 
    From: ary sucaya 
    To: MapGuide Users Mail List 
    Sent: Wednesday, January 02, 2008 6:32 AM
    Subject: Re: [mapguide-users] Sql For Data Filter


    Thanks Kenneth,

    I'm looking for sample code of making data filter programmatically and save in into current session.



    Regards,


    Ary Sucaya


    ----- Original Message ----
    From: "Kenneth, GEOGRAF A/S" <ks at geograf.dk>
    To: MapGuide Users Mail List <mapguide-users at lists.osgeo.org>
    Sent: Wednesday, January 2, 2008 10:08:48 AM
    Subject: Re: [mapguide-users] Sql For Data Filter

    I think the "Query" part of the "Generic Tasks" is close to what you want:
    http://data.mapguide.com/mapguide/gt/index.php

    More samples:
    http://mapguide.osgeo.org/livegallery.html

Regards, Kenneth, GEOGRAF A/S


    ary sucaya skrev: 
      Great!, I will try
      I was wondering if there is a sample code for it..
      Thank v much..

      regards,

      Ary Sucaya

       
      ----- Original Message ----
      From: "Kenneth, GEOGRAF A/S" <ks at geograf.dk>
      To: MapGuide Users Mail List <mapguide-users at lists.osgeo.org>
      Sent: Wednesday, January 2, 2008 8:46:05 AM
      Subject: Re: [mapguide-users] Sql For Data Filter

      I don't have a list of what the different providers support.
      I have used the OGR provider, and it supports PostGIS and limited SQL.

      My approach to your problem would be to start out with the layer hidden.
      When you want to display the correct district, you read out the WKT of the feature (district) you want to perform the intersection test with.
      Then you update the filter on the layer to reflect this:
      GeoColumn Intersects GEOMFROMTEXT('....wkt....')
      Then show the layer.

      You should copy the layer into the session repository before altering it.
      If you want to theme it, you can create multiple copies of the layer and apply theming to the individual layers.

Regards, Kenneth, GEOGRAF A/S
  

      ary sucaya skrev: 
        Thank for your reply,

        Can you pls inform me what provider support full sql syntax? I use postgis and it seem to be not support full sql syntax.
        In my case, i can't use join tables because i need spatial relationship between 2 tables. For examples in Mapguide sample there are 11 districts. At first time, i want to hide parcels. Then i want to make a query to show parcels in particular distric and i want maps show parcels which are in that query result. In this case, join between two tables may not help me. I make use spatial relationship such as intersects or within in this case.

        Regards,

        Ary Sucaya

         
        ----- Original Message ----
        From: "Kenneth, GEOGRAF A/S" <ks at geograf.dk>
        To: MapGuide Users Mail List <mapguide-users at lists.osgeo.org>
        Sent: Tuesday, January 1, 2008 5:25:05 PM
        Subject: Re: [mapguide-users] Sql For Data Filter

        That depends on the provider. Some providers supports full SQL syntax.

        I can't see how you can join tables with a filter, as that is the equvalent of the SQL WHERE construct.
        You can try to setup a Join on the featuresource, but I have had limited success with joins.

Regards, Kenneth, GEOGRAF A/S
  

        ary sucaya skrev: 
          Hello,

          I was wondering if i can put a complex sql statement at 'Filter applied to data' textbox on Layer Editor. I need to show some data from my postgis table and sql to select this data involving 2 or more table.


          Regs,

          ary sucaya


----------------------------------------------------------------------
          Never miss a thing. Make Yahoo your homepage. 
----------------------------------------------------------------------
_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
  



------------------------------------------------------------------------
        Looking for last minute shopping deals? Find them fast with Yahoo! Search. 
------------------------------------------------------------------------
_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
  



--------------------------------------------------------------------------
      Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. 
--------------------------------------------------------------------------
_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
  



----------------------------------------------------------------------------
    Never miss a thing. Make Yahoo your homepage. 


    _______________________________________________
    mapguide-users mailing list
    mapguide-users at lists.osgeo.org
    http://lists.osgeo.org/mailman/listinfo/mapguide-users





------------------------------------------------------------------------------
  Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.




------------------------------------------------------------------------------
  Never miss a thing. Make Yahoo your homepage. 


------------------------------------------------------------------------------


  _______________________________________________
  mapguide-users mailing list
  mapguide-users at lists.osgeo.org
  http://lists.osgeo.org/mailman/listinfo/mapguide-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20080103/5de6da64/attachment.html


More information about the mapguide-users mailing list