RE: [mapserver-users] Re: Reg:About Native Microsoft SQL Server 2008 Driver for MapServer
Anybody knows if this plugin exists in osgeo4w? Or if I can download ms4w and "steal" the plugin from there? At least I have not managed to find it within my recently updated osgeo4w installation Morten Sickel Norwegian Radiation Protection Authority -Original Message- From: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Kiks Sent: Wednesday, February 24, 2010 3:48 PM To: mapserver-users@lists.osgeo.org Subject: [mapserver-users] Re: Reg:About Native Microsoft SQL Server 2008 Driver for MapServer A read-only, native MapServer driver that connects to Microsoft SQL Server 2008's spatial capabilities is available in MS4W as of version 2.3.0. Steps to Enable SQL Server 2008 Support in MS4W's MapServer The plugin exists in /ms4w/Apache/specialplugins/msplugin_mssql2008.dll Modify your SQL Server 2008 layer in your mapfile to use the CONNECTIONTYPE PLUGIN parameter and point to the appropriate plugin using the PLUGIN parameter. Use the CONNECTION parameter to specify the required connection parameters to access SQL Server, and use the DATA parameter to specify the table that holds the spatial information: LAYER ... CONNECTIONTYPE PLUGIN PLUGIN "C:/ms4w/Apache/specialplugins/msplugin_mssql2008.dll" CONNECTION "server=mysqlserver2008.com;uid=dbusername; pwd=dbpassword;database=Roads Database; Integrated Security=false" DATA "the_geom from roads" TYPE LINE STATUS ON CLASS ... END END Test your layer, possibly by using the shp2img commandline utility with the '-all_debug 5' switch The associated RFC document with the original notes on this support is RFC 38 -- View this message in context: http://n2.nabble.com/Reg-About-Native-Microsoft-SQL-Server-2008-Driver-for-MapServer-tp1971580p4626221.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ 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] CGI-wrapper script on windows / openlayers wmsgetfeatureinfo
I found another answer myself, guess this counts as a bit more elegant than a cgi-wrapper script ;-) I use the mod_rewrite in apache, following these three steps: 1) Comment out the mod_rewrite line in httpd.conf 2) Enable mod_rewrite for the actual document root. I am using virtual servers and added the following lines in the actual section: Options FollowSymLinks AllowOverride All (where "c:\documents and settings\vserver\radioecology" is the htdocs directory for the relevant virtual server) 2.5 Restart apache 3 make a .htaccess file in the actual directory: RewriteEngine on RewriteRule ^wmsmap?(.*) /cgi-bin/mapserv.exe?map=/documents+and+settings/vserver/radioecology/mobilweb/mobilwms.map&$1 The rewriteRule says: given a webpage starting with wmsmap, pick out the query parameters, make a new page request starting with /cgi-bin/mapserv.exe?map=(...)? and add on whatever was the query parameter in the original page request. ie, /wmsmap?mode=map will be rewritten to /cgi-bin/mapserv.exe?map=/documents+and+settings/vserver/radioecology/mobilweb/mobilwms.map&mode=map Quite simple when one just knows how to do it. I would propose to add something like the text above to chapter 12.6 A Simple CGI Wrapper Script in the manual - that would at least have saved me quite some time.. -- Morten Sickel Norwegian Radiation Protection Authority -Original Message- From: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Morten Sickel Sent: Wednesday, February 10, 2010 6:17 PM To: mapserver-users@lists.osgeo.org Subject: [mapserver-users] CGI-wrapper script on windows / openlayers wmsgetfeatureinfo I have mapserver up and running, now I'm trying to use openlayers. Some simpler pars work fine, but when I get to OpenLayers.Control.WMSGetFeatureInfo I need to use a wrapper script to hide the map= parameter, but how to do that on windows? Or, is there some way to add the parameter? I have tried querier = new OpenLayers.Control.WMSGetFeatureInfo({ url: url, title: "Test", map:wmsfile, layers: [mobile], queryVisible: true }); where the wmsfile is a pointer to the wmsfile in the filesystem (works fine in OpenLayers.Layer.WMS) but when the query is sent, the map-parameter has not been taken into account. Do I need a wrapper script, or have I overlooked something in openlayers? Morten Sickel Norwegian Radiation Protection Authority ___ 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] CGI-wrapper script on windows / openlayers wmsgetfeatureinfo
I have mapserver up and running, now I'm trying to use openlayers. Some simpler pars work fine, but when I get to OpenLayers.Control.WMSGetFeatureInfo I need to use a wrapper script to hide the map= parameter, but how to do that on windows? Or, is there some way to add the parameter? I have tried querier = new OpenLayers.Control.WMSGetFeatureInfo({ url: url, title: "Test", map:wmsfile, layers: [mobile], queryVisible: true }); where the wmsfile is a pointer to the wmsfile in the filesystem (works fine in OpenLayers.Layer.WMS) but when the query is sent, the map-parameter has not been taken into account. Do I need a wrapper script, or have I overlooked something in openlayers? Morten Sickel Norwegian Radiation Protection Authority ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
RE: [mapserver-users] PHP MapScript pixel coordinates to map coordinates
Seems like noone have answered this yet... In fact, it is as easy as using proportions. Mapservers mapextent is given in units of the actual projection of the maå. If you need to have the extent in another projection, the cornerpoints can be reprojected. Morten -Original Message- From: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Shorthouse, David Sent: Wednesday, January 20, 2010 4:57 AM To: mapserver-users@lists.osgeo.org Subject: [mapserver-users] PHP MapScript pixel coordinates to map coordinates Folks, This question has no doubt been asked many times, but for the life of me I cannot find a solution. Here's what I'm trying to do: I have a jQuery-based front-end that uses the wonderful jcrop extension (http://deepliquid.com/content/Jcrop.html) that helps coordinate zoom. I'm hoping to use this same front-end to permit cropping of a resultant map image, which means I need to pass the four pixel corner coordinates, convert to map coordinates (projection may be variable), then set the extent such that the resultant map image will have the same dimensions as that described by the user on the front-end. So, how can I convert pixel coordinates to map coordinates? Note that the map projection is not always DD so I cannot merely use proportions as I have seen in some solutions. Surely this is easier than I am making it out to be. Thanks for any advice, David Shorthouse ___ 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] Projection and mapquery
OK, i found a workaround to the original problem: > I presently have a set up in which I plot some measurements on some > background maps. Things work fine, but I want to add the possibility > to query the measurement data set by clicking on a measurement. The > measurements have coordinates in lat lon and I only manage to query > those data if I plot the entire map in the same projection. (the map should be in utm, I would prefer not having to reproject the measurement locations) I create a new map object with the layer to be queried, set the projection of the new map object to the same as the queried layer and then I do a queryByPoint on the new map object. This works to get find a object. To plot the query map, I get a unique id for the selected point, do a queryByAttributes on the corresponding layer in the drawn map. -- Morten Sickel Norwegian Radiation Protection Authority === php code == some parts removed // I am querying a map layer called "mobile" // I am using smarty templating for my php script, if you don't know that, just consider the // $smarty->assign calls as a way to get something printed out. function pix2geo($mapx,$mapy,$minx,$miny,$maxx,$maxy,$sizex,$sizey) // calculates geographical coordinates in the map from click coordinates on the image { list($miny,$maxy)=array($maxy,$miny); // swaps miny and max y since the coordinates acsends upwards in the map, downwards in the picture $geopoint=array(); foreach( array('x','y') as $dim){ $p=array(); foreach(array('map','min','max','size') as $par){ $name="$par$dim"; $p[$par]=$$name; } $geowidth=$p['max']-$p['min']; $geopoint[$dim]=$p['map']/$p['size']*$geowidth+$p['min']; } return(array($geopoint['x'],$geopoint['y'])); } $map=ms_newMapObj($map_path.'mobilweb.map'); $foundresults=false; if($_GET['extent']){ list($minx,$miny,$maxx,$maxy)=explode(" ",$_GET['extent']); $map->setextent($minx,$miny,$maxx,$maxy); } $clickpoint=ms_newpointObj(); $clickpoint->setXY($_GET['MAP_x']*1,$_GET['MAP_y']*1); if(!isset($_GET['update'])){ if($_GET['action']=='QUERY'){ list($geoX,$geoY)=pix2geo($_GET['MAP_x']*1,$_GET['MAP_y']*1,$minx,$miny,$maxx,$maxy,$map->width,$map->height); $geopoint=ms_newpointObj(); $geopoint->setXY($geoX,$geoY); $mapproj=$map->getProjection(); $layerproj=$map->getlayerbyname('mobil')->getProjection(); if($mapproj!=$layerproj){ $oMapproj=ms_newProjectionObj($mapproj); $oLayerproj=ms_newProjectionObj($layerproj); $geopoint->project($oMapproj, $oLayerproj); // projects the point from the projection of the map to the projection of layer $newmap=$map->clone(); // Might be better to make a new object and then add the querylayer to that object $newmap->setProjection($layerproj); $querymap=$newmap; }else{ $querymap=$map; } $resu...@$querymap->queryByPoint($geopoint, MS_SINGLE , -1); if ( $result==MS_FAILURE ) {$smarty->assign('mapmessage','No data found');} $layername='mobil'; $layerfield='id'; $oLayer = $querymap->GetLayerByName($layername); $numResults = $oLayer->getNumResults(); if($numResults){ $foundresults=true; $oLayer->open(); for ($iRes=0; $iRes < $numResults; $iRes++) { $oRes = $oLayer->getResult($iRes); $oShape = $oLayer->getShape($oRes->tileindex,$oRes->shapeindex); $result=$oShape->values[$layerfield]; $smarty->assign('queryresult',$result); $smarty->assign('querytime',date("Y.m.d H:i:s",$oShape->values['utctime'])); $oShape->free; } $oLayer->close; if($querymap!=$map){ // Must transfer the information back to the map that is to be plot
RE: [mapserver-users] Projection and mapquery
Josh, Thanks, but could you please elaborate this a bit? Do you mean that you are doing a reprojection in mapscript of the projected layer or that you are projecting the layer 'as saved' before mapserver gets to see i at all? since the query is towards the map object, I cannot see how I can do any more reprojection of the layer, except what has been done when the layer was plotted. -- Morten Sickel Norwegian Radiation Protection Authority -Original Message- From: Josh Hevenor [mailto:jheve...@rogers.com] Sent: Thursday, January 28, 2010 8:42 PM To: Morten Sickel Subject: Re: [mapserver-users] Projection and mapquery I have to wrap my head around this subject every time I come back to it. I've only done this using $layer->queryByPoint() and I tend to project both the layer and the point into the map projection. Not much of a hint but something to consider, Josh Morten Sickel wrote: > I presently have a set up in which I plot some measurements on some > background maps. Things work fine, but I want to add the possibility > to query the measurement data set by clicking on a measurement. The > measurements have coordinates in lat lon and I only manage to query > those data if I plot the entire map in the same projection. > Are there any ways to overcome this? As I am mostly working on maps from 60 > deg north and upwards, geographical projection > is not the projection of choise and I would prefer not having to reproject > the measurement data. > > ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] SV: Projection and mapquery
Sorry, forgot to say mapserver version 5.2.2 from osgeo4w php 5.2.5 if that matters Morten Fra: mapserver-users-boun...@lists.osgeo.org [mapserver-users-boun...@lists.osgeo.org] på vegne av Morten Sickel [morten.sic...@nrpa.no] Sendt: 28. januar 2010 19:37 Til: mapserver-users@lists.osgeo.org Emne: [mapserver-users] Projection and mapquery I presently have a set up in which I plot some measurements on some background maps. Things work fine, but I want to add the possibility to query the measurement data set by clicking on a measurement. The measurements have coordinates in lat lon and I only manage to query those data if I plot the entire map in the same projection. I have tried to reproject the query point using code like $mapproj=$map->getProjection(); $layerproj=$map->getlayerbyname('mobil')->getProjection(); if($mapproj!=$layerproj){ $mapproj=ms_newProjectionObj($mapproj); $layerproj=ms_newProjectionObj($layerproj); debug(array($geopoint->x,$geopoint->y)); $geopoint->project($mapproj, $layerproj); // projects the point from the projection of the map to the projection of layer debug(array($geopoint->x,$geopoint->y)); } the debug function just dumps the data and it is clear that the point is correctly reprojected, but anyhow $map->queryByPoint($geopoint, MS_MULTIPLE, 1); never gives anything if the mobil-layer and the map are in different projections. Are there any ways to overcome this? As I am mostly working on maps from 60 deg north and upwards, geographical projection is not the projection of choise and I would prefer not having to reproject the measurement data. M.___ 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] Projection and mapquery
I presently have a set up in which I plot some measurements on some background maps. Things work fine, but I want to add the possibility to query the measurement data set by clicking on a measurement. The measurements have coordinates in lat lon and I only manage to query those data if I plot the entire map in the same projection. I have tried to reproject the query point using code like $mapproj=$map->getProjection(); $layerproj=$map->getlayerbyname('mobil')->getProjection(); if($mapproj!=$layerproj){ $mapproj=ms_newProjectionObj($mapproj); $layerproj=ms_newProjectionObj($layerproj); debug(array($geopoint->x,$geopoint->y)); $geopoint->project($mapproj, $layerproj); // projects the point from the projection of the map to the projection of layer debug(array($geopoint->x,$geopoint->y)); } the debug function just dumps the data and it is clear that the point is correctly reprojected, but anyhow $map->queryByPoint($geopoint, MS_MULTIPLE, 1); never gives anything if the mobil-layer and the map are in different projections. Are there any ways to overcome this? As I am mostly working on maps from 60 deg north and upwards, geographical projection is not the projection of choise and I would prefer not having to reproject the measurement data. M.___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] RE: filter doesn't work (wfs)
Retrying, this time with a numerical attribute, it works. :-) But as far as I can see from the examples, it should also work with textual data? using mapserver 5.4.2 from ms4w. Morten -Original Message- From: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Morten Sickel Sent: Wednesday, August 12, 2009 3:12 PM To: mapserver-users@lists.osgeo.org Subject: [mapserver-users] filter doesn't work (wfs) I have set up a mapserver wfs-server. Works fine, except that I cannot get Filter= to work. I tried urls like those at the bottom on http://mapserver.org/ogc/filter_encoding.html , but got all the data back in all cases. I tested it in a browser and to a working url, I appended &Filter=status RUN Where status is one of the fields on the WFS coverage and some of the items has status=RUN. I also tried but in both cases, I got the complete data set returned. By setting to an invalid value, I managed to get an empty data set. From the documentation, it seems like I do it the right way, but something must be wrong. I hope someone can enlighten me. -- Morten Sickel Norwegian Radiation Protection Authority ___ 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] filter doesn't work (wfs)
I have set up a mapserver wfs-server. Works fine, except that I cannot get Filter= to work. I tried urls like those at the bottom on http://mapserver.org/ogc/filter_encoding.html , but got all the data back in all cases. I tested it in a browser and to a working url, I appended &Filter=status RUN Where status is one of the fields on the WFS coverage and some of the items has status=RUN. I also tried but in both cases, I got the complete data set returned. By setting to an invalid value, I managed to get an empty data set. From the documentation, it seems like I do it the right way, but something must be wrong. I hope someone can enlighten me. -- Morten Sickel Norwegian Radiation Protection Authority ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
RE: [mapserver-users] GIS and GPS
Raphael, As far as I can understand, what you are trying to do is what is known as an overlay I don't know how to do that in mapserver / PostGIS, but I would guess some kind of spatial query in postgis should help you. best wishes Morten Sickel From: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Rafael chacón Sent: Monday, January 26, 2009 4:17 PM To: mapserver-users@lists.osgeo.org Subject: [mapserver-users] GIS and GPS Hello, I'm trying to develop an application that takes points input from a GPS ... And I would like to realize when those points enter at certain points .. Suppose a state or cities... I'm working with Mapserver and PostGIS .. Someone can give me an idea of how to accomplish this? Thanks in advanced. -- Rafael Chacon, "El hombre es la medida de todas las cosas". Protagoras ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
SV: [mapserver-users] Need Help with Custom (Raster) Data as Input
Dear Muizudeen, As far as I understand you,you try to do three things at once - Learn GIS - Learn a new programming tool (mapserver et.al.) - Clean up your existing data All these goals are good to try to achieve, but not at once. Most of all, when starting to learn GIS and starting to learn mapserver, you should be sure that the data you are using are of good quality, i.e. at least well defined projection and geo references, if that is not correctly set up, What I would recommend you to do is to start up using some other available data sets of the same type as what you are using (geo tiffs, or whatever) Set up a map server application using those data sets, read up on projections and geo referencing, try to find some other data sets covering the same area as the first you got, but in other projections, play around a bit with those data, also changing the projection of the map-file. This way you know that what you are doing in map server makes sense. parallell with this, you can try to collect the nessecary information on the other maps you have, and make a new map-file using those data sets. If the maps are scanned files, they can be made into geo-tiffs, ie a tiff file and a corresponding tfw file, the latter giving the coordinates for one of the corners of the map, the cell size and the rotation angle of the map, I don't remember the details at the moment, but that should be quite easy to google for. best wishes. Morten Fra: mapserver-users-boun...@lists.osgeo.org [mapserver-users-boun...@lists.osgeo.org] på vegne av Muizudeen Kusimo [devbo...@gmail.com] Sendt: 26. januar 2009 09:16 Til: mapserver-users@lists.osgeo.org Emne: Re: [mapserver-users] Need Help with Custom (Raster) Data as Input Dear All, I appreciate the responses I have received so far but I am new to GIS so please do not take offense at my (trivial) questions. I want to: a) Build a web application like Google Maps. I have: b) Little map data that needs to be re-drawn due to it's poor quality, lack of geo-reference info and lack of coordinate grid. c) Adjusted my map extents as advised by Rahkonen for display in Ka-Maps without luck. d) Being reading the manuals for MapServer, Ka-Map, OpenLayers and QGIS. I hope to adopt either OpenLayers or Ka-Map as my UI + MapServer as my backend. I would like this list to: e) Guide me on how to achieve my aim in (a) above using my choice of technology in (d) below. Specifically, how do I prepare my poor maps (that better be re-drawn) for the tools I am studying. f) Offer any other useful advice. Lastly, if my questions are too elementary for this list. Can someone please point me to an appropriate list/website/irc channel. Thanks in advance. - Muizz ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Mapserver etopo projection problem
Hi, As a many year gis user, but fairly new to internet mapping applications, I am getting my feet wet by experimenting a bit with mapserver. As I am doing a lot of mapping of marine areas, I want to use the etopo dataset as a backdrop, but something goes terribly wrong when I try to project it. In my mapfile, I have defined the extent and projetion as: EXTENT -80 -150 85 130 #LAEA UNITS METERS PROJECTION "proj=laea" # "lat_0=70" "lon_0=15" END And the etopo dataset is fetched as: LAYER PROJECTION "init=epsg:4326" END NAME Etopo2 TYPE RASTER OFFSITE 0 0 0 STATUS ON CONNECTIONTYPE WMS CONNECTION "http://map.ngdc.noaa.gov/servlet/com.esri.wms.Esrimap?servicename=Deck41"; METADATA "wms_srs" "EPSG:4326" "wms_name" "MODIS/ETOPO2 Relief" "wms_server_version" "1.1.0" "wms_format" "image/jpeg" END END # Etopo2 WMS image ends here What I end up with then can be seen in http://radioecology.info/images/etopo_laea.png (the red lines are administrative borders in Norway) if I make the same map without projection, it ends up like http://radioecology.info/images/etopo_geo.png (the borders are supposed to extend a bit out into the sea) If I try to ue the topographical gtopo map, I fetch it with etop LAYER NAME GTOPO TYPE RASTER OFFSITE 0 0 0 STATUS OFF CONNECTIONTYPE WMS CONNECTION "http://imsref.cr.usgs.gov:80/wmsconnector/com.esri.wms.Esrimap/USGS_EDC_Elev_GTOPO?"; METADATA "wms_srs" "EPSG:4326" "wms_name" "GLOBAL.GTOPO60_COLOR_RELIEF" "wms_server_version" "1.1.1" "wms_format" "image/jpeg" END PROJECTION "init=epsg:4326" END END And I get http://radioecology.info/images/gtopo_laea.png which looks just right. Any Idea of what goes wrong? The etopo dataset obiously gets projected, but I have no idea about how, I have also tried a few other projections, getting the same result, etopo freaking out, gtopo working nicely... Have anyone had any success in reprojecting etopo? Are there any other wms sources I can use? (Of cource, I can download the tiles I need and reproject and mess around with them as I like to, but it would also be useful to be able to use the etopo wms server. Morten -- Morten Sickel Norwegian Radiation Protection Authority ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users