Re: VS: [mapserver-users] Mapserver search performance
Hi Andreas, I have looked and looked but could not find how to use ogr2ogr to do the operation I am interested in. Could you point me in the right direction here as to how can ogr2ogr be used to add new fields to an existing dbf file from another dbf file. The external dbf file from which I need to fetch data does not have a corresponding shp file associated with it. Its just a simple data file that has a common field with the shp file attributes. Varun On Wed, May 4, 2011 at 4:23 AM, Eichner, Andreas - SID-NLKM andreas.eich...@sid.sachsen.de wrote: Hi. The first thing to note: editing a DBF with Excel Co. seems to be a _really_ bad idea. Those who tried that got Shapes wired to wrong attribute lines. So DBF, SHP, SHX and QIX files have to be used as a whole or will usually end up in a corrupted dataset. I would suggest ogr2ogr from the GDAL suite. It's fast, reliable, can do joins and is aware of the mentioned dependencies. Please note that such a fileset can only provide a spatial index via a QIX file. This is OK if you only want to filter by BBOX. If you want to filter by attribute all lines of the DBF still need to be scanned. In such cases it's wise to use ogr2ogr to split the data in pre-filtered sets. Using a more sophisticated database like PostGIS or SpatialLite can help you implement more complex scenarios. Since MapServer has no native driver for SpatialLite it's probably not as fast as it is supposed to be. This mostly depends on OGRs implementation. Greetings Is there a DBF editor out there that can be used to import the fields from any external data source into the shapefile attribute DBF without affecting the structure? I looked for a lot but they do not have the capability of doing a JOIN based on a common field and pulling data into the shapefile DBF automatically. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: VS: [mapserver-users] Mapserver search performance
Hi, Thanks a lot Andreas. That JOIN was the culprit as you rightly suggested. Once I removed the join, the performance increased exponentially. The 5 minute cgi run now took under 5 seconds which is simply amazing. I just need one more help. Is there a DBF editor out there that can be used to import the fields from any external data source into the shapefile attribute DBF without affecting the structure? I looked for a lot but they do not have the capability of doing a JOIN based on a common field and pulling data into the shapefile DBF automatically. My company cannot afford the ArcGis software. Thanks, Varun On Fri, Apr 15, 2011 at 2:40 AM, Eichner, Andreas - SID-NLKM andreas.eich...@sid.sachsen.de wrote: Hi, AFAIK dBase files don't provide an index themselves and there's no other way to provide one. shptree only creates an spatial index. Therefore only queries like 'does this geometry touch/intersect/lie within a given rectangle'can be accelerated. I tried the shptree tool but did not see any performance improvement. So this becomes clear: By doing a JOIN MapServer basically runs a loop: for each geometry that matches search withing external data for a line matching the join condition. Could it be because all of this information that I require is coming from an external DBF file that I join to the layer/shape's DBF? Will including all these fields/information in the shape's DBF file itself help? I'm pretty sure that this would help, since this would avoid the (unaccelerated) join. With a database like PostgreSQL/PostGIS or SQlite it's basically the same problem: if you don't create an appropriate index for the join condition, this becomes an costly operation. Although those columns are usually primary and foreign key columns with appropriate index and the join condition is usually a simple equality match. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: VS: [mapserver-users] Mapserver search performance
Hi, Thanks a lot for the quick help. I am a PHP/Java guy. I shall try my luck with some sort of PHP scripting as I need a solution fairly quickly. I had made the suggestion of shifting to a PostGIS system quite some time back but I guess you know how it is with approvals :) Thanks again, Varun On Tue, May 3, 2011 at 4:42 PM, Mr. Puneet Kishor punk.k...@gmail.com wrote: On May 3, 2011, at 3:36 PM, Varun saraf wrote: Hi Puneet, Thanks a lot for the prompt reply. I tried using Excel 2007 and was not able to re-save the dbf file after editing. Also, I am having DBF files with about a million records and Excel tends to hang for these operations. Now you tell us ;-). My sense is that most gui-based tools will choke on million+ rows. You might well want to upgrade to a Pg/PostGIS solution at some point, but I realize that is not what you are asking for... (also, I believe the most recent Excel versions might have lost the DBF translation capabilities -- I am not an Excel person, so I can't confirm... besides, I use Macs, and Excel is most likely hobbled on Macs anyway). Is there some tool other than Excel which can do these operations? I remember using Perl and XBase.pm to do this. It was really very quick and trivial, but it was a long time ago. Choose your language of choice. Try R. Thanks, Varun On Tue, May 3, 2011 at 4:27 PM, Mr. Puneet Kishor punk.k...@gmail.com wrote: On May 3, 2011, at 3:19 PM, Varun saraf wrote: ..Is there a DBF editor out there that can be used to import the fields from any external data source into the shapefile attribute DBF without affecting the structure? I looked for a lot but they do not have the capability of doing a JOIN based on a common field and pulling data into the shapefile DBF automatically. Just use MS-Excel or any program that can open up and write DBF. As long as you are careful to not change the number of rows, just add additional columns, and make sure the column names are not changed, and follow the various DBF limitations, you should be ok. Make sure to keep a backup of the original DBF in case things go ka-pow! Since the DBF data and the geometry are in separate files, there is no issue with adding more attributes provide you follow the care noted above. .. Puneet. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: VS: [mapserver-users] Mapserver search performance
Hi, I tried the shptree tool but did not see any performance improvement. It fetched results about 4-5 seconds faster. Without QIX files, it was 5 minutes and with QIX files, it took about 4 minutes and 56 seconds. All of my requests are based on the MAPSHAPE parameter in NQUERY mode. I noticed that mapserver was taking about 1 second for outputting the information in the template file for each feature. Could it be because all of this information that I require is coming from an external DBF file that I join to the layer/shape's DBF? Will including all these fields/information in the shape's DBF file itself help? Does mapserver pick up each feature and use a point in polygon approach to check if it lies in the provided shape? If yes, how can i make this process faster. Is there a way of making it multi-threaded or do more checks per second? I am providing sample code. Hope this helps. I have about 35 layers in my map file. Should I merge all these into a single layer? MAP FILE LAYER NAME L1 METADATA qstring_validation_pattern '.' END STATUS DEFAULT TYPE point DATA BLKS_01 TOLERANCE 0 TOLERANCEUNITS METERS CLASS STYLE OUTLINECOLOR 255 0 0 END END JOIN NAME external TABLE data/externalData.dbf FROM Field1 TO Field1 TYPE ONE-TO-ONE END TEMPLATE blockTemplate.xml END Template File == [GEOID],[Field1],[LON],[LAT],[external_ID],[external_NAME],[external_STA],[external_NEEDSCORE],[external_MINSCORE]; Request === http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/apps/GIS/centroides.mapmode=nquerymapshape=-99.757833 32.474433 -99.758005 32.450679 -99.726591 32.447637 -99.727621 32.474723 Any help in this regard is greatly appreciated. Let me know if you need any more information. Thanks, Varun On Mon, Apr 11, 2011 at 3:06 PM, Varun saraf vsaraf@gmail.com wrote: Thanks a lot for the quick reply. I will give it a try. On Mon, Apr 11, 2011 at 1:50 PM, Rahkonen Jukka jukka.rahko...@mmmtike.fi wrote: Hi, Shptree will help and stopwatch will tell you how much. Without spatial index Mapserver needs to go through the whole shapefile every time. Have a try, it will not take very many seconds to run shptree. Make different requests, take times with and without .qix files and you will some numbers. Change the requests and request order (query 1 with .qix/withour qix, query 2 without .qix/with .qix) so that you can see if you are actually testing the speed of disk access and memory cache access and not the effect of having spatial index. By adding DEBUG 5 for your layer you don't need stopwatch but you'll get timings into ms_errorfile. -Jukka Rahkonen- Varun saraf wrote: Hello Everyone, I have programmed a GIS application using Mapserver, Google maps and Tilecache. The functionality of this GIS application is to extract the data (from the dbf file) for all features (Points) within a randomly drawn user shape and doing some statistical operation on that data. I use an NQUERY mode with MAPSHAPE attribute to get all the data for the user drawn shape. Mapserver takes aout 5-10 seconds for a small shape (a couple of square miles) but as the shape gets bigger (hundreds of square miles), the time taken to fetch all data related to the features/points lying in the shape grows exponentially (Upto 2 hours for some shapes). Until now, we were restricting the maximum area a shape can have but we have to get rid of that. Is there a way to improve the performance in any way? Will SHPTREE work for this purpose? The features are currently points only but we may move to polygons in future. We use the .shp files for the shapes. Is it advantageous to move to a database instead? If yes, what database works best? What I did notice is that for any given request to mapserver, however large the shape, the CPU utilization never crosses 12%. Can we improve performance by increasing the RAM or maybe move to a solid state hard drive? There is also the possibility of moving this application to Cloud computing. Anything that will improve the performance actually. Can someone point me in the right direction as to what might be the current bottleneck? T current setup is on windows and uses MS4W on an Apache server. Thanks, Varun ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Mapserver search performance
Hello Everyone, I have programmed a GIS application using Mapserver, Google maps and Tilecache. The functionality of this GIS application is to extract the data (from the dbf file) for all features (Points) within a randomly drawn user shape and doing some statistical operation on that data. I use an NQUERY mode with MAPSHAPE attribute to get all the data for the user drawn shape. Mapserver takes aout 5-10 seconds for a small shape (a couple of square miles) but as the shape gets bigger (hundreds of square miles), the time taken to fetch all data related to the features/points lying in the shape grows exponentially (Upto 2 hours for some shapes). Until now, we were restricting the maximum area a shape can have but we have to get rid of that. Is there a way to improve the performance in any way? Will SHPTREE work for this purpose? The features are currently points only but we may move to polygons in future. We use the .shp files for the shapes. Is it advantageous to move to a database instead? If yes, what database works best? What I did notice is that for any given request to mapserver, however large the shape, the CPU utilization never crosses 12%. Can we improve performance by increasing the RAM or maybe move to a solid state hard drive? There is also the possibility of moving this application to Cloud computing. Anything that will improve the performance actually. Can someone point me in the right direction as to what might be the current bottleneck? T current setup is on windows and uses MS4W on an Apache server. Thanks, Varun ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: VS: [mapserver-users] Mapserver search performance
Thanks a lot for the quick reply. I will give it a try. On Mon, Apr 11, 2011 at 1:50 PM, Rahkonen Jukka jukka.rahko...@mmmtike.fi wrote: Hi, Shptree will help and stopwatch will tell you how much. Without spatial index Mapserver needs to go through the whole shapefile every time. Have a try, it will not take very many seconds to run shptree. Make different requests, take times with and without .qix files and you will some numbers. Change the requests and request order (query 1 with .qix/withour qix, query 2 without .qix/with .qix) so that you can see if you are actually testing the speed of disk access and memory cache access and not the effect of having spatial index. By adding DEBUG 5 for your layer you don't need stopwatch but you'll get timings into ms_errorfile. -Jukka Rahkonen- Varun saraf wrote: Hello Everyone, I have programmed a GIS application using Mapserver, Google maps and Tilecache. The functionality of this GIS application is to extract the data (from the dbf file) for all features (Points) within a randomly drawn user shape and doing some statistical operation on that data. I use an NQUERY mode with MAPSHAPE attribute to get all the data for the user drawn shape. Mapserver takes aout 5-10 seconds for a small shape (a couple of square miles) but as the shape gets bigger (hundreds of square miles), the time taken to fetch all data related to the features/points lying in the shape grows exponentially (Upto 2 hours for some shapes). Until now, we were restricting the maximum area a shape can have but we have to get rid of that. Is there a way to improve the performance in any way? Will SHPTREE work for this purpose? The features are currently points only but we may move to polygons in future. We use the .shp files for the shapes. Is it advantageous to move to a database instead? If yes, what database works best? What I did notice is that for any given request to mapserver, however large the shape, the CPU utilization never crosses 12%. Can we improve performance by increasing the RAM or maybe move to a solid state hard drive? There is also the possibility of moving this application to Cloud computing. Anything that will improve the performance actually. Can someone point me in the right direction as to what might be the current bottleneck? T current setup is on windows and uses MS4W on an Apache server. Thanks, Varun ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Boundary overlay shift
Hello, I have been using Mapserver with Tilecache and Google maps to display polygon boundary overlays for some time now. However, the users complain that the overlay is not accurate if they zoom in to the map (zoom level 14 onwards). Is this a problem with the projection scheme being used? I think my data is in epsg 4326 format. What projection scheme does google maps use? Its strange that everything looks fine at the higher levels but when I zoom in beyond level 13, the boundary gets misaligned though the shape of the boundaries is accurate. Has anyone solved this problem? If yes, it would be great if you can point me in the correct direction. BTW, I use ms4w for windows and the GtileOverlay method with tilecache to render the boundary overlays. Thanks, Varun ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Google Maps Tile overlay shift
Hi, For some time now, I have been using Mapserver with Tilecache and Google maps to display census tract overlays to users. However, the users complain that the overlay is not accurate if they zoom into the map (say level 13 onwards). Is this a problem with the projection scheme being used? I think my data is in epsg 4326 format and google uses 900913 I think. I insrted this into the Proj 4 epsg file but still the overlays are shifted by a bit. If anyone who has solved this problem can direct me, it would be a great help. BTW, I use ms4w for windows and the GtileOverlay method with tilecache. Thanks, Varun ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Custom Draw Shape by User
Hi, I am using mapserver as tile layer (USA county boundaries) on google maps. I have been given a requirement where a user, can go to a specific zoom level on the maps and draw a custom shape (mostly a poygon Using GPolygon) on google maps. I then need to provide the user with an average data of all the counties that fall within this custom shape. Now, I can fetch the data for every county the user clicks on, but if the user does not click on a county but it still falls within the custom shape, is there a way for me to know the same?? Is there a way to provide this custom shape to mapserver using the geo latitude and longitide, so mapserver itself can give me the list of all counties that fall within this? Please help me in this regard. Thanks, Varun ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Class level Transparency/Opacity
Hello, Is it possible to set a transparency rate for the CLASS level Color? Below is my mapfile. I am using this layer on google maps in tile mode. When I do so, the base map is getting completely overlapped by the colored polygons. I need a level of transparency so that the base map's roads and location are visible. In other words, I only want to highlight the polygons that match the expression criteria. Can someone tell me what I need to do for the same? I have already tried putting in OPACITY field in the layer object but it only lightens the color without making it transparent. an OPACITY of 1 renders the polygons white in color. MAP NAME drawBothMap TRANSPARENT ON IMAGETYPE PNG PROJECTION init=epsg:4326 END LAYER NAME USABOTH STATUS DEFAULT METADATA wms_title example_layer END TYPE polygon DATA USA CLASSITEM QCT CLASS EXPRESSION '1' COLOR 255 0 0 END CLASS EXPRESSION '2' COLOR 0 255 0 END CLASS EXPRESSION '3' COLOR 0 0 255 END END END Thanks, Varun ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Class level Transparency/Opacity
Hello, Is it possible to set a transparency rate for the CLASS level Color? Below is my mapfile. I am using this layer on google maps in tile mode. When I do so, the base map is getting completely overlapped by the colored polygons. I need a level of transparency so that the base map's roads and location are visible. In other words, I only want to highlight the polygons that match the expression criteria. Can someone tell me what I need to do for the same? I have already tried putting in OPACITY field in the layer object but it only lightens the color without making it transparent. an OPACITY of 1 renders the polygons white in color. MAP NAME drawBothMap TRANSPARENT ON IMAGETYPE PNG PROJECTION init=epsg:4326 END LAYER NAME USABOTH STATUS DEFAULT METADATA wms_title example_layer END TYPE polygon DATA USA CLASSITEM QCT CLASS EXPRESSION '1' COLOR 255 0 0 END CLASS EXPRESSION '2' COLOR 0 255 0 END CLASS EXPRESSION '3' COLOR 0 0 255 END END END Thanks, Varun ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Precache
Hi Roger, I am trying to get my mapserver and tilecache work together but its somehow not working. I am using the same projection as you in all my layers and the mapfile. (This works when I call my mapserver directly from google and hence the projection is right). Here is my mapfile (Only things that might be important). MAP EXTENT -173 5 -45 75 IMAGETYPE PNG PROJECTION init=epsg:4326 END WEB METADATA wms_srs EPSG:4326 EPSG:900913 END END LAYER PROJECTION init=epsg:4326 END END Next I added the 900913 epsg to the proj.4 of mapserver and made the required changes in tilecache.cfg file as you specified. [google-tiles] type=MapServerLayer mapfile=C:/ms4w/apps/QCTGIS/drawMap.map metaTile=true metaSize=2,2 metaBuffer=0,500 layers=tr20_d00 spherical_mercator=true srs=EPSG:900913 I am not sure if the linkn I am using is wrong. I have tilecache installed in the cgi directory of the apache server that was installed using ms4. The example index.html that comes with tilecache works fine and I can see the images being cached. Also my mapserver directly works fine. Can you tell me what is it that I am doing wrong here? the link I use for the tileUrlTemplate in google maps is http://127.0.0.1:8123/cgi-bin/tilecache-2.10/tilecache.cgi/1.0.0/google-tiles/{Y}/{X}/{Z}.png?type=google;. I can also see that this call gets initiated in the apache logs (access.log) but nothing happens therafter. I don't even know if this is failing at tilecache end and mapserver isn't being called at all or at mapserver's end where the image is not being sent by mapserver. Can you help me out here? Thanks a lot. Varun On Thu, May 21, 2009 at 12:46 PM, Roger Andréran...@gmail.com wrote: Ahh, ok. I'm not sure in what fashion you are using TileCache, but my experience has been with using it to create tiles to display in Google Maps. Google Maps uses the projection which is EPSG:900913. I believe there are other codes for it, but that is the one I use. All of my source data for the MapServer projects I make are in EPSG:4326. So there are 3 things I need to do in order to make the Tilecache output tiles align correctly in Gmaps. 1. I set both the mapfile and the layer projections to EPSG:4326. MAP NAME 'v2_80m_global' PROJECTION init=epsg:4326 END LAYER NAME 'imagery' PROJECTION init=epsg:4326 END snip... 2. I explicity allow for a wms request to be made for the layer in EPSG:900913 by setting the following in my MapServer LAYER: METADATA wms_srs EPSG:4326 EPSG:900913 snip... 3. I define my TileCache layer so that it requests images from Mapserver in EPSG:900913. [v2_20m_global] type=MapServerLayer mapfile=/var/www/mapfiles/v2_20m_global/v2_20m_global.map metaTile=true metaSize=2,2 metaBuffer=0,500 layers=imagery spherical_mercator=true srs=EPSG:900913 That's what works for me. Roger -- On Thu, May 21, 2009 at 5:24 AM, Chad Clabaugh cclaba...@centwire.com wrote: Thank you Roger, for your response. I have done that but I do not understand how tilecache works. The images that are returned from mapserver line up perfectly. But the images returned from tilecache do not align very well (they're distorted). If tilecache is simply caching the returned images then I do not understand where this distortion comes from. Any thoughts? Thanks! -Original Message- From: Roger André [mailto:ran...@gmail.com] Sent: Wednesday, May 20, 2009 11:46 PM To: Chad Clabaugh Cc: mapserver-users@lists.osgeo.org Subject: Re: [mapserver-users] Precache Your request is somewhat lacking in detail, but assuming that your goal is a simple one, here is one way to accomplish this. 1. Create a MapServer project that displays your shapefile in whatever style you choose. 2. Setup a TileCache instance that points to your MapServer project. 3. Run the tilecache_seed.py script to pre-generate tiles. Roger -- On Wed, May 20, 2009 at 12:16 PM, Chad Clabaugh cclaba...@centwire.com wrote: How can I precache tile images from shapefiles? Thanks Chad Clabaugh Technical Support, Engineering Office: 260.760.6398 Mobile: 260.466.8861 ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Precache
Hello, I have got this (tilecache with mapserver on google maps) working finally after a lot of problems but I now really need to know about how to do a pre-cache of all the tiles from mapserver. I am running tilecache 2.10 on Windows with mapserver ms4w from maptools.org. I tried running tilecache_seed.py as per the suggestion above but it always ends up in the following error Traceback (most recent call last): File C:\ms4w\Apache\cgi-bin\tilecache-2.10\tilecache_seed.py, line 9, in mo dule TileCache.Client.main() File C:\ms4w\Apache\cgi-bin\tilecache-2.10\TileCache\Client.py, line 153, in main layer = svc.layers[args[0]] IndexError: list index out of range Any help in this regard would be great. Thanks, Varun On Fri, Jun 19, 2009 at 2:39 PM, Varun sarafvsaraf@gmail.com wrote: Hi Roger, I am trying to get my mapserver and tilecache work together but its somehow not working. I am using the same projection as you in all my layers and the mapfile. (This works when I call my mapserver directly from google and hence the projection is right). Here is my mapfile (Only things that might be important). MAP EXTENT -173 5 -45 75 IMAGETYPE PNG PROJECTION init=epsg:4326 END WEB METADATA wms_srs EPSG:4326 EPSG:900913 END END LAYER PROJECTION init=epsg:4326 END END Next I added the 900913 epsg to the proj.4 of mapserver and made the required changes in tilecache.cfg file as you specified. [google-tiles] type=MapServerLayer mapfile=C:/ms4w/apps/QCTGIS/drawMap.map metaTile=true metaSize=2,2 metaBuffer=0,500 layers=tr20_d00 spherical_mercator=true srs=EPSG:900913 I am not sure if the linkn I am using is wrong. I have tilecache installed in the cgi directory of the apache server that was installed using ms4. The example index.html that comes with tilecache works fine and I can see the images being cached. Also my mapserver directly works fine. Can you tell me what is it that I am doing wrong here? the link I use for the tileUrlTemplate in google maps is http://127.0.0.1:8123/cgi-bin/tilecache-2.10/tilecache.cgi/1.0.0/google-tiles/{Y}/{X}/{Z}.png?type=google;. I can also see that this call gets initiated in the apache logs (access.log) but nothing happens therafter. I don't even know if this is failing at tilecache end and mapserver isn't being called at all or at mapserver's end where the image is not being sent by mapserver. Can you help me out here? Thanks a lot. Varun On Thu, May 21, 2009 at 12:46 PM, Roger Andréran...@gmail.com wrote: Ahh, ok. I'm not sure in what fashion you are using TileCache, but my experience has been with using it to create tiles to display in Google Maps. Google Maps uses the projection which is EPSG:900913. I believe there are other codes for it, but that is the one I use. All of my source data for the MapServer projects I make are in EPSG:4326. So there are 3 things I need to do in order to make the Tilecache output tiles align correctly in Gmaps. 1. I set both the mapfile and the layer projections to EPSG:4326. MAP NAME 'v2_80m_global' PROJECTION init=epsg:4326 END LAYER NAME 'imagery' PROJECTION init=epsg:4326 END snip... 2. I explicity allow for a wms request to be made for the layer in EPSG:900913 by setting the following in my MapServer LAYER: METADATA wms_srs EPSG:4326 EPSG:900913 snip... 3. I define my TileCache layer so that it requests images from Mapserver in EPSG:900913. [v2_20m_global] type=MapServerLayer mapfile=/var/www/mapfiles/v2_20m_global/v2_20m_global.map metaTile=true metaSize=2,2 metaBuffer=0,500 layers=imagery spherical_mercator=true srs=EPSG:900913 That's what works for me. Roger -- On Thu, May 21, 2009 at 5:24 AM, Chad Clabaugh cclaba...@centwire.com wrote: Thank you Roger, for your response. I have done that but I do not understand how tilecache works. The images that are returned from mapserver line up perfectly. But the images returned from tilecache do not align very well (they're distorted). If tilecache is simply caching the returned images then I do not understand where this distortion comes from. Any thoughts? Thanks! -Original Message- From: Roger André [mailto:ran...@gmail.com] Sent: Wednesday, May 20, 2009 11:46 PM To: Chad Clabaugh Cc: mapserver-users@lists.osgeo.org Subject: Re: [mapserver-users] Precache Your request is somewhat lacking in detail, but assuming that your goal is a simple one, here is one way to accomplish this. 1. Create a MapServer project that displays your shapefile in whatever style you choose. 2. Setup a TileCache instance that points to your MapServer project. 3. Run the tilecache_seed.py script to pre-generate tiles. Roger -- On Wed, May 20, 2009 at 12:16 PM, Chad Clabaugh cclaba...@centwire.com wrote: How can I precache tile images
Re: [mapserver-users] Finding the centroid given the feature
Center of the geometry works perfect. I need to get access to any point inside the polygon feature. I believe I can use an itemQuery on mapserver to query the attribute but how does mapserver return the center point? Do I need to create an HTML template for that too? On Mon, Jun 1, 2009 at 4:11 PM, Steve Lime steve.l...@dnr.state.mn.us wrote: MapServer templates can produce a center point for a geometry but it's not a true centroid but those aren't guaranteed to be in the polygon. MapScript could be used as well I suppose. In either case you'd send a lookup request to the CGI or MapScript, do an attribute query and return whatever you'd need. Steve On 5/29/2009 at 9:32 AM, in message 6db14d250905290732pb01747wce200eddfe73d...@mail.gmail.com, Varun saraf vsaraf@gmail.com wrote: I am using mapserver 5.0 with google maps and the data source is the US Census tracts as shape files and dbf files. On Thu, May 28, 2009 at 2:12 PM, Steve Lime steve.l...@dnr.state.mn.us wrote: What version are you using? What data source? Steve On 5/28/2009 at 10:01 AM, in message 6db14d250905280801q3660a6a7ycbcd5f5a238c5...@mail.gmail.com, Varun saraf vsaraf@gmail.com wrote: Hi, I know mapserver uses a point-in-polygon method to find a feature given a set of co-ordinates, but can it do the same thing reversed? For example. Each polygon I draw has a number associated with it which is in a dbf file with the same name as the shp file that mapserver uses to draw the polygons. My current map file allows me to fetch that unique number whenever I pass the co-ordinates of any point inside that polygon (mapserver uses the point-in-polygon method to fetch me the polygonID). The query I use is http://127.0.0.1:8123/cgi-bin/mapserv.exe?map=C:/ms4w/apps/workshop-5.0/testMa p.mapmode=querymapxy=-77.098617 38.87795 where mapxy keeps changing based on the user's click. The html template I send just has the variable name [polygonID] which helps me get the polygon ID of the point I specify in the mapxy variable. Now, is there a way in which I can send this polygonID to mapserver and get hold of any point (perhaps the centroid) inside of this polygon? Can someone point me in the right direction here? Thanks a lot. -Varun ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Finding the centroid given the feature
Thanks a lot Steve. I am able to use the itemquery to fetch the other attributes correctly but somehow, the center of polygon isn't working right. Its returning to me, the co-ordinates that are outside the bounds of the mapping application. All my data is in the actual geographic co-ordinate system followed by Google maps and it returns a latitude/longitude pair corresponsing to some place in Antarctica. Any idea on what might be wrong? On Tue, Jun 2, 2009 at 1:50 PM, Steve Lime steve.l...@dnr.state.mn.us wrote: Yes, you'd need to create a template for that. You could return JSON, XML, csv or whatever. This would be the most straightfoward using 5.2 or ideally 5.4.1 (due out today) and the new style templates. You could create a template output format to use like so: OUTPUTFORMAT NAME 'geom_center' DRIVER 'TEMPLATE' MIMETYPE 'text/plain' FORMATOPTION 'FILE=geom_center.tmpl' END where geom_center.tmpl might look like: !-- MapServer Template -- [shpmidx],[shpmidy] and your query would look like: http://.../cgi-bin/mapserv?map=foo.map...itemquery stuff...qformat=geom_center Steve On 6/2/2009 at 12:17 PM, in message 6db14d250906021017kb56f49ak36b4d0e4be417...@mail.gmail.com, Varun saraf vsaraf@gmail.com wrote: Center of the geometry works perfect. I need to get access to any point inside the polygon feature. I believe I can use an itemQuery on mapserver to query the attribute but how does mapserver return the center point? Do I need to create an HTML template for that too? On Mon, Jun 1, 2009 at 4:11 PM, Steve Lime steve.l...@dnr.state.mn.us wrote: MapServer templates can produce a center point for a geometry but it's not a true centroid but those aren't guaranteed to be in the polygon. MapScript could be used as well I suppose. In either case you'd send a lookup request to the CGI or MapScript, do an attribute query and return whatever you'd need. Steve On 5/29/2009 at 9:32 AM, in message 6db14d250905290732pb01747wce200eddfe73d...@mail.gmail.com, Varun saraf vsaraf@gmail.com wrote: I am using mapserver 5.0 with google maps and the data source is the US Census tracts as shape files and dbf files. On Thu, May 28, 2009 at 2:12 PM, Steve Lime steve.l...@dnr.state.mn.us wrote: What version are you using? What data source? Steve On 5/28/2009 at 10:01 AM, in message 6db14d250905280801q3660a6a7ycbcd5f5a238c5...@mail.gmail.com, Varun saraf vsaraf@gmail.com wrote: Hi, I know mapserver uses a point-in-polygon method to find a feature given a set of co-ordinates, but can it do the same thing reversed? For example. Each polygon I draw has a number associated with it which is in a dbf file with the same name as the shp file that mapserver uses to draw the polygons. My current map file allows me to fetch that unique number whenever I pass the co-ordinates of any point inside that polygon (mapserver uses the point-in-polygon method to fetch me the polygonID). The query I use is http://127.0.0.1:8123/cgi-bin/mapserv.exe?map=C:/ms4w/apps/workshop-5.0/testMa p.mapmode=querymapxy=-77.098617 38.87795 where mapxy keeps changing based on the user's click. The html template I send just has the variable name [polygonID] which helps me get the polygon ID of the point I specify in the mapxy variable. Now, is there a way in which I can send this polygonID to mapserver and get hold of any point (perhaps the centroid) inside of this polygon? Can someone point me in the right direction here? Thanks a lot. -Varun ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Finding the centroid given the feature
I had my mapfile extent changed and it worked Perfect. Thanks a lot Steve. It was a great help! On Tue, Jun 2, 2009 at 4:16 PM, Varun saraf vsaraf@gmail.com wrote: Thanks a lot Steve. I am able to use the itemquery to fetch the other attributes correctly but somehow, the center of polygon isn't working right. Its returning to me, the co-ordinates that are outside the bounds of the mapping application. All my data is in the actual geographic co-ordinate system followed by Google maps and it returns a latitude/longitude pair corresponsing to some place in Antarctica. Any idea on what might be wrong? On Tue, Jun 2, 2009 at 1:50 PM, Steve Lime steve.l...@dnr.state.mn.us wrote: Yes, you'd need to create a template for that. You could return JSON, XML, csv or whatever. This would be the most straightfoward using 5.2 or ideally 5.4.1 (due out today) and the new style templates. You could create a template output format to use like so: OUTPUTFORMAT NAME 'geom_center' DRIVER 'TEMPLATE' MIMETYPE 'text/plain' FORMATOPTION 'FILE=geom_center.tmpl' END where geom_center.tmpl might look like: !-- MapServer Template -- [shpmidx],[shpmidy] and your query would look like: http://.../cgi-bin/mapserv?map=foo.map...itemquery stuff...qformat=geom_center Steve On 6/2/2009 at 12:17 PM, in message 6db14d250906021017kb56f49ak36b4d0e4be417...@mail.gmail.com, Varun saraf vsaraf@gmail.com wrote: Center of the geometry works perfect. I need to get access to any point inside the polygon feature. I believe I can use an itemQuery on mapserver to query the attribute but how does mapserver return the center point? Do I need to create an HTML template for that too? On Mon, Jun 1, 2009 at 4:11 PM, Steve Lime steve.l...@dnr.state.mn.us wrote: MapServer templates can produce a center point for a geometry but it's not a true centroid but those aren't guaranteed to be in the polygon. MapScript could be used as well I suppose. In either case you'd send a lookup request to the CGI or MapScript, do an attribute query and return whatever you'd need. Steve On 5/29/2009 at 9:32 AM, in message 6db14d250905290732pb01747wce200eddfe73d...@mail.gmail.com, Varun saraf vsaraf@gmail.com wrote: I am using mapserver 5.0 with google maps and the data source is the US Census tracts as shape files and dbf files. On Thu, May 28, 2009 at 2:12 PM, Steve Lime steve.l...@dnr.state.mn.us wrote: What version are you using? What data source? Steve On 5/28/2009 at 10:01 AM, in message 6db14d250905280801q3660a6a7ycbcd5f5a238c5...@mail.gmail.com, Varun saraf vsaraf@gmail.com wrote: Hi, I know mapserver uses a point-in-polygon method to find a feature given a set of co-ordinates, but can it do the same thing reversed? For example. Each polygon I draw has a number associated with it which is in a dbf file with the same name as the shp file that mapserver uses to draw the polygons. My current map file allows me to fetch that unique number whenever I pass the co-ordinates of any point inside that polygon (mapserver uses the point-in-polygon method to fetch me the polygonID). The query I use is http://127.0.0.1:8123/cgi-bin/mapserv.exe?map=C:/ms4w/apps/workshop-5.0/testMa p.mapmode=querymapxy=-77.098617 38.87795 where mapxy keeps changing based on the user's click. The html template I send just has the variable name [polygonID] which helps me get the polygon ID of the point I specify in the mapxy variable. Now, is there a way in which I can send this polygonID to mapserver and get hold of any point (perhaps the centroid) inside of this polygon? Can someone point me in the right direction here? Thanks a lot. -Varun ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Finding the centroid given the feature
I am using mapserver 5.0 with google maps and the data source is the US Census tracts as shape files and dbf files. On Thu, May 28, 2009 at 2:12 PM, Steve Lime steve.l...@dnr.state.mn.us wrote: What version are you using? What data source? Steve On 5/28/2009 at 10:01 AM, in message 6db14d250905280801q3660a6a7ycbcd5f5a238c5...@mail.gmail.com, Varun saraf vsaraf@gmail.com wrote: Hi, I know mapserver uses a point-in-polygon method to find a feature given a set of co-ordinates, but can it do the same thing reversed? For example. Each polygon I draw has a number associated with it which is in a dbf file with the same name as the shp file that mapserver uses to draw the polygons. My current map file allows me to fetch that unique number whenever I pass the co-ordinates of any point inside that polygon (mapserver uses the point-in-polygon method to fetch me the polygonID). The query I use is http://127.0.0.1:8123/cgi-bin/mapserv.exe?map=C:/ms4w/apps/workshop-5.0/testMa p.mapmode=querymapxy=-77.098617 38.87795 where mapxy keeps changing based on the user's click. The html template I send just has the variable name [polygonID] which helps me get the polygon ID of the point I specify in the mapxy variable. Now, is there a way in which I can send this polygonID to mapserver and get hold of any point (perhaps the centroid) inside of this polygon? Can someone point me in the right direction here? Thanks a lot. -Varun ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Finding the centroid given the feature
Hi, I know mapserver uses a point-in-polygon method to find a feature given a set of co-ordinates, but can it do the same thing reversed? For example. Each polygon I draw has a number associated with it which is in a dbf file with the same name as the shp file that mapserver uses to draw the polygons. My current map file allows me to fetch that unique number whenever I pass the co-ordinates of any point inside that polygon (mapserver uses the point-in-polygon method to fetch me the polygonID). The query I use is http://127.0.0.1:8123/cgi-bin/mapserv.exe?map=C:/ms4w/apps/workshop-5.0/testMap.mapmode=querymapxy=-77.098617 38.87795 where mapxy keeps changing based on the user's click. The html template I send just has the variable name [polygonID] which helps me get the polygon ID of the point I specify in the mapxy variable. Now, is there a way in which I can send this polygonID to mapserver and get hold of any point (perhaps the centroid) inside of this polygon? Can someone point me in the right direction here? Thanks a lot. -Varun ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Re: Dynamic data loading using Google maps andMapserver
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.mapmode=querymapxy=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@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.l...@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=querymap=something.mapmapxy=google_x+google_yqlayer=the_polygons or do a WFS query. Since you're already using straight MapServer the former would probably be easiest. Steve Varun saraf vsaraf@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_...@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.l...@dnr.state.mn.us To: vsaraf@gmail.com Subject: Re: [mapserver-users] Re: Dynamic data loading using Google maps andMapserver CC: mapserver-users@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
Re: [mapserver-users] Re: Dynamic data loading using Google maps andMapserver
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.l...@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 6db14d250905071027j7ff0aac8j30edeb7f8c938...@mail.gmail.com, Varun saraf vsaraf@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=querymapxy=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@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.l...@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=querymap=something.mapmapxy=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@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_...@hotmail.com: A beautiful example that uses the Google Maps API is: http
Re: [mapserver-users] Re: Dynamic data loading using Google maps andMapserver
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.l...@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=querymap=something.mapmapxy=google_x+google_yqlayer=the_polygons or do a WFS query. Since you're already using straight MapServer the former would probably be easiest. Steve Varun saraf vsaraf@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_...@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.l...@dnr.state.mn.us To: vsaraf@gmail.com Subject: Re: [mapserver-users] Re: Dynamic data loading using Google maps andMapserver CC: mapserver-users@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@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@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@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@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@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo
Re: [mapserver-users] Re: Dynamic data loading using Google maps andMapserver
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_...@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.l...@dnr.state.mn.us To: vsaraf@gmail.com Subject: Re: [mapserver-users] Re: Dynamic data loading using Google maps andMapserver CC: mapserver-users@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@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@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@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@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@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Dynamic data loading using Google maps and Mapserver
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@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users