[mapserver-users] Re: Dynamic data loading using Google maps andMapserver

Steve Lime Steve.Lime at dnr.state.mn.us
Thu May 7 11:55:59 PDT 2009


Make sure with polygon data to explicitly set TOLERANCE 0 in the layer definition to make
sure the point is in the polygon.

Steve

>>> On 5/7/2009 at 1:15 PM, in message
<6db14d250905071115s6e44aec2g625edda034c78e37 at mail.gmail.com>, Varun saraf
<vsaraf.gmu at gmail.com> wrote:
> yes my data is in lat, long. I discovered the inverse lat long in
> mapxy just after sending this email and tried it. It works now but the
> New problem is that the result is a little tweaked. I guess its a
> problem with the projection. The tract number is not the current one
> when I click somewhere on the border of a tract. The projection is not
> that big a problem for me right now. I need to get this thing up and
> running by EOD with google maps (The dynamic clicking on the map etc).
> 
> Thanks a lot for the prompt reply.
> 
> On Thu, May 7, 2009 at 1:32 PM, Steve Lime <Steve.Lime at dnr.state.mn.us> wrote:
>> Something's backwards, you're mapxy is 38.87795, -77.098617 but your extents 
> are neg,pos,neg,pos? Also
>> is your data in lat/lon?
>>
>> Steve
>>
>>>>> On 5/7/2009 at 12:27 PM, in message
>> <6db14d250905071027j7ff0aac8j30edeb7f8c9389e3 at mail.gmail.com>, Varun saraf
>> <vsaraf.gmu at gmail.com> wrote:
>>> Hi All,
>>>
>>> I am trying to integrate the census tracts on the google maps base. I
>>> am using the tile mode and have successfully drawn the shape files
>>> over the states of USA. I have some data in an access database that I
>>> need to show to the user when he selects a particular census tract
>>> (the shapes are polygons). However, since its a tile mode that I am
>>> using on google maps, I am unable to understand how do I get the
>>> information from mapserver as to which census tract was selected by
>>> the user? Is there a way mapserver can send me the polygon selected
>>> based on a co-ordinate lying inside the polygon? I know there is a way
>>> by using queries and a querymap for doing this. The query that I am
>>> using is as follows
>>>
>>> http://127.0.0.1:8123/cgi-bin/mapserv.exe?&map=C:/ms4w/apps/census/testMap.map& 
>>> mode=query&mapxy=38.87795
>>> -77.098617
>>>
>>> I am providing a template in my map file that has the tract variables.
>>> However, the result is always the same
>>>
>>> "msQueryByPoint(): Search returned no results. No matching record(s)
>>> found." Is it that mapserver is trying to look for a point feature in
>>> the location specifies by mapxy in the link above? How do I make
>>> mapserver to look for a polygon enclosing this co-ordinate and return
>>> me the result? I am attaching my mapfile also for reference.
>>>
>>> MAP
>>>     NAME testMap
>>>     STATUS ON
>>>     SIZE 600 300
>>>     EXTENT -84 37 -75 40
>>>     UNITS DD
>>>     SHAPEPATH "data"
>>>     IMAGECOLOR 255 255 255
>>>     CONFIG "MS_ERRORFILE" "ms_error.txt"
>>>
>>>     IMAGETYPE PNG
>>>
>>>     WEB
>>>       IMAGEPATH "/ms4w/tmp/ms_tmp/"
>>>       IMAGEURL "/ms_tmp/"
>>>     END
>>>
>>>     QUERYMAP
>>>         STATUS ON
>>>         STYLE HILITE
>>>     END
>>>
>>>     LAYER
>>>         NAME "virginia"
>>>         STATUS DEFAULT
>>>         TYPE polygon
>>>         DATA tr51_d00
>>>         DEBUG 5
>>>         TOLERANCE 1000
>>>         TOLERANCEUNITS pixels
>>>
>>>         TEMPLATE "bodytemplate.html"
>>>         HEADER "imapheader.html"
>>>         FOOTER "imapfooter.html"
>>>
>>>         CLASS
>>>          STYLE
>>>             OUTLINECOLOR 128 128 128
>>>             COLOR 153 205 255
>>>           END
>>>          TEMPLATE "pointTemplate.html"
>>>       END
>>>
>>>     END
>>> END
>>>
>>> Thanks,
>>> Varun
>>>
>>> On Mon, May 4, 2009 at 3:30 PM, Varun saraf <vsaraf.gmu at gmail.com> wrote:
>>>> Hi Steve,
>>>>
>>>> If I provide Mapserver with a point x,y in WGS84 projection (from
>>>> google maps) as a query, can mapserver give me the enclosing polygon
>>>> information (using point-in-polygon method or something else)? If yes,
>>>> how? I have already drawn the polygons on google map using tile mode.
>>>> Can you suggest me a book/doc that helps with querying mapserver?
>>>>
>>>> Thanks,
>>>> Varun
>>>>
>>>> On Sun, May 3, 2009 at 9:56 AM, Steve Lime <Steve.Lime at dnr.state.mn.us> wrote:
>>>>> Both examples show how to do this. You have to create a query using
>>>>> the coordinate from Google to access MapServer. My example uses the
>>>>> principle to query points but would work for polygons (which are actually
>>>>> easier). You could issue straight MapServer queries:
>>>>>
>>>>>
>>> http://.../cgi-bin/mapserv?mode=query&map=something.map&mapxy=google_x+google_y 
>>> &qlayer=the_polygons
>>>>>
>>>>> or do a WFS query. Since you're already using straight MapServer the former
>>>>> would probably be easiest.
>>>>>
>>>>> Steve
>>>>>
>>>>>>>> Varun saraf <vsaraf.gmu at gmail.com> 05/02/09 1:34 PM >>>
>>>>> Hi,
>>>>>
>>>>> Thanks a lot Jim and Steve. These are great examples but I am dividing
>>>>> each state of USA into about 1300 polygons and I need a way to find
>>>>> which polygon is selected by the user. I tried building Gpolygons
>>>>> using the polygon data that i have (after converting it into a GML
>>>>> file) but it makes Google damn slow to redraw the polygons on zoom in
>>>>> and zoom out. The tile mode in mapserver is much faster.
>>>>>
>>>>> Now, After I draw the polygon in tile mode using mapserver, Is there a
>>>>> way Mapserver can return to me the specific polygon info (say
>>>>> co-ordinates or any other data in the dbf file relating to that
>>>>> polygon) when I select it on google map? Goggle I believe can give me
>>>>> the exact co-ordinates of the point I clicked. Can mapserver use this
>>>>> point location to find which polygon was selected?
>>>>>
>>>>> Thanks,
>>>>> Varun
>>>>>
>>>>> 2009/5/2 Jim Strevinas <voas_acc at hotmail.com>:
>>>>>> A beautiful example that uses the Google Maps API is:
>>>>>>
>>>>>> http://www.dyasdesigns.com/geoxml/gmlusa.htm 
>>>>>>
>>>>>> It makes use of an API plugin called geoxml that can load XML data which can
>>>>>> be produced by
>>>>>> a WFS server. In the source code, a static GML file is used but a google
>>>>>> search shows that it can
>>>>>> connect to a live WFS server using the URL.
>>>>>>
>>>>>>> Date: Sat, 2 May 2009 09:28:01 -0500
>>>>>>> From: Steve.Lime at dnr.state.mn.us 
>>>>>>> To: vsaraf.gmu at gmail.com 
>>>>>>> Subject: Re: [mapserver-users] Re: Dynamic data loading using Google maps
>>>>>>> andMapserver
>>>>>>> CC: mapserver-users at lists.osgeo.org 
>>>>>>>
>>>>>>> One way to do that is to construct MapServer queries based on the event
>>>>>>> and submit them using AJAX. This site does just that but with OpenLayers:
>>>>>>>
>>>>>>> http://www.dnr.state.mn.us/waters/csg/index_copy.html 
>>>>>>>
>>>>>>> Click on the dots and a MapServer query is done behind the scenes. If
>>>>>>> successful
>>>>>>> a little window control is populated, if not, then nothing happens. Simple
>>>>>>> templates
>>>>>>> are used to present the information.
>>>>>>>
>>>>>>> Steve
>>>>>>>
>>>>>>> >>> Varun saraf <vsaraf.gmu at gmail.com> 05/01/09 11:54 AM >>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I just had a look at ImageMap Template on "Output generation"...Can
>>>>>>> this be used on google maps to get information pooped up on a
>>>>>>> mouseover or mouseclick in tile mode? If not, what is it that I can do
>>>>>>> to get a similar result when using Mapserver with google maps?
>>>>>>>
>>>>>>> Regards,
>>>>>>> Varun
>>>>>>>
>>>>>>> On Thu, Apr 30, 2009 at 6:30 PM, Varun saraf <vsaraf.gmu at gmail.com> wrote:
>>>>>>> > Hi,
>>>>>>> >
>>>>>>> > I have successfully drawn layers on of google maps as base using
>>>>>>> > mapserver. However, I am trying to figure out how to get data
>>>>>>> > dynamically displayed on the web page when a user clicks on a certain
>>>>>>> > area. For example, I have divided the entire state of virginia into
>>>>>>> > many sectors (using a polygon shp file). My requirement is that I want
>>>>>>> > data to come up on the map/web page when the user selects a particular
>>>>>>> > sector. I know google provides me with an event api for clicking on
>>>>>>> > the map but how do I pass this event to mapserver so it can send me
>>>>>>> > the label for that sector from the shape file? I need to be able to
>>>>>>> > recognize what sector the user has clicked. Is this possible using
>>>>>>> > just the mapserv cgi script and a map file or a MapScript has to be
>>>>>>> > written/used? Can someone point me in the right direction here? Even
>>>>>>> > providing the link for a previous discussion on this topic would help.
>>>>>>> >
>>>>>>> > Thanks,
>>>>>>> > Varun
>>>>>>> >
>>>>>>> _______________________________________________
>>>>>>> mapserver-users mailing list
>>>>>>> mapserver-users at lists.osgeo.org 
>>>>>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users 
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> mapserver-users mailing list
>>>>>>> mapserver-users at lists.osgeo.org 
>>>>>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users 
>>>>>>
>>>>>> ________________________________
>>>>>> Invite your mail contacts to join your friends list with Windows Live
>>>>>> Spaces. It's easy! Try it!
>>>>>> _______________________________________________
>>>>>> mapserver-users mailing list
>>>>>> mapserver-users at lists.osgeo.org 
>>>>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users 
>>>>>>
>>>>>>
>>>>> _______________________________________________
>>>>> mapserver-users mailing list
>>>>> mapserver-users at lists.osgeo.org 
>>>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users 
>>>>>
>>>>>
>>>>
>>> _______________________________________________
>>> mapserver-users mailing list
>>> mapserver-users at lists.osgeo.org 
>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users 
>>



More information about the MapServer-users mailing list