[mapserver-users] Reading KML
Hi, I have a kml file in which there is a folder containing both Line and Point geometry placemarks. I want to show both line and point geomerty on map using mapserver. but the issue is that the data source is same. so how can i show the point and line data on map. Please help me. -- *Alok Mathur* | Software Engineer 2A | Ciena Mobile +91 9899413266 ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Reading KML
PFB the KML and MAP file. KML file ?xml version=1.0 encoding=UTF-8? kml xmlns=http://www.opengis.net/kml/2.2; xmlns:gx= http://www.google.com/kml/ext/2.2; xmlns:kml=http://www.opengis.net/kml/2.2; xmlns:atom=http://www.w3.org/2005/Atom; Document Folder nameFibertech solution/name Placemark nameWestborough MSC - Build/name styleUrl#msn_ylw-pushpin4/styleUrl LineString tessellate1/tessellate coordinates -71.58570500983306,42.28745742866225,0 -71.58563778135751,42.28308954118536,0 -71.58466087108053,42.28307704913402,0 /coordinates /LineString /Placemark Placemark nameWestborough MSC to Westborugh/name styleUrl#msn_ylw-pushpin8/styleUrl LineString tessellate1/tessellate coordinates -71.62172195712955,42.27186897741407,0 -71.6219495552,42.27189433043378,0 -71.6225634332947,42.27210480296427,0 -71.62308968672842,42.27236391420707,0 -71.62394597288645,42.27309147863262,0 -71.62737594489003,42.27740640295431,0 -71.62822373584245,42.27893783334968,0 -71.63091971519079,42.2816476278,0 -71.63207040059587,42.28370221254578,0 -71.62599732629406,42.28418518334991,0 -71.60795611539982,42.28517668969011,0 -71.60267209851122,42.28504601944216,0 -71.60188701357249,42.28516492137062,0 -71.58850360403626,42.28849573666959,0 -71.5858004650346,42.28852197680775,0 -71.58571706491037,42.2874804233345,0 /coordinates /LineString /Placemark Placemark nameNEW Danbury/name Camera longitude-73.45375129836707/longitude latitude41.390460041635/latitude altitude419.0806930250601/altitude heading13.43312150541231/heading tilt28.58299225276625/tilt roll-0.685026358787494/roll gx:altitudeModerelativeToSeaFloor/gx:altitudeMode /Camera styleUrl#msn_ylw-stars/styleUrl Point gx:drawOrder1/gx:drawOrder coordinates-73.45404626023216,41.3929335947184,0/coordinates /Point /Placemark /Folder /Document /kml --- MAP = MAP NAME QGIS-MAP # Map image size SIZE 500 400 UNITS meters EXTENT -73.454046 41.392934 -71.584661 42.288522 #FONTSET './fonts/fonts.txt' #SYMBOLSET './symbols/symbols.txt' #PROJECTION # 'proj=longlat' # 'datum=WGS84' # 'no_defs' #END PROJECTION init=epsg:4326 END # Background color for the map canvas -- change as desired IMAGECOLOR 255 255 255 IMAGEQUALITY 95 IMAGETYPE png OUTPUTFORMAT NAME png DRIVER GD/PNG MIMETYPE image/png IMAGEMODE RGBA EXTENSION png TRANSPARENT ON END # Legend LEGEND IMAGECOLOR 255 255 255 STATUS ON KEYSIZE 18 12 LABEL TYPE BITMAP SIZE MEDIUM COLOR 0 0 89 END END # Web interface definition. Only the template parameter # is required to display a map. See MapServer documentation WEB # Set IMAGEPATH to the path where MapServer should # write its output. IMAGEPATH /tmp/ms_tmp/ # Set IMAGEURL to the url that points to IMAGEPATH # as defined in your web server configuration IMAGEURL /ms_tmp/ # WMS server settings METADATA wms_enable_request * wms_srs EPSG:900913 EPSG:4326 EPSG:3857 EPSG:2154 EPSG:310642901 EPSG:4171 EPSG:310024802 EPSG:310915814 EPSG:310486805 EPSG:310702807 EPSG:310700806 EPSG:310547809 EPSG:310706808 EPSG:310642810 EPSG:310642801 EPSG:310642812 EPSG:310032811 EPSG:310642813 EPSG:2986 labelcache_map_edge_buffer -10 wms_title osm fiber data wms_onlineresource http://haxv-onecontrol-154/cgi-bin/mapserv?; ows_sld_enable true END #Scale range at which web interface will operate # Template and header/footer settings # Only the template parameter is required to display a map. See MapServer documentation #TEMPLATE 'fooOnlyForWMSGetFeatureInfo' END # Start of LAYER DEFINITIONS - LAYER NAME kml_example_point TYPE POINT STATUS DEFAULT CONNECTIONTYPE OGR CONNECTION doc_test.kml DATA Fibertech solution LABELITEM NAME CLASS #NAME Fiber Names
[mapserver-users] Errors with LAYER DATA geom FROM (...huge SELECT...)
Hi all, We have some layers in Oracle where the map config specifies: LAYER ... DATA geom FROM ( SELECT a_very_long_select_statement_with_lots_of_%PARAMS% FROM some_table ) USING FILTER ... END After a certain length of the SELECT, we get strange errors: an imcomplete SQL statement is being sent to Oracle. Turns out that this is due to the define in maporaclespatial.c: #define TABLE_NAME_SIZE2000 Since I found no other alternatives, I was only able to fix it by changing this define and recompiling Mapserver. This particular assumption (that 2000 characters ought to be enough for anybody) is still present in the Mapserver 7 source code. Additionally, the buffer to hold the query string is hard-coded as: char query_str[6000]; Shouldn't this be fixed (or made configurable), or at least, clearly documented somewhere? The current situation is, frankly, sub-optimal... Kind regards, -- -- Gertjan van Oosten, Principal Consultant, West Consulting B.V. -- gert...@west.nl +31 15 2191 600 www.west.nl ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Reading KML
You need use the special field OGR_GEOMETRY to filter by geometry type. With ogrinfo this can be done as follows: $ ogrinfo -al test.kml -where OGR_GEOMETRY='LINESTRING' $ ogrinfo -al test.kml -where OGR_GEOMETRY='POINT' Not sure how to translate this into mapfile syntax. May be using LAYER.FILTER, LAYER.DATA or (on MapServer 7.0) PROCESSING_OPTION NATIVE_FILTER. Using FILTER might not work due to MapServer blocking the virtual attribute... LAYER TYPE POINT ... FILTER ('[OGR_GEOMETRY]' == 'POINT') ... END Or LAYER TYPE POINT ... DATA SELECT * FROM 'Fibertech solution' WHERE OGR_GEOMETRY='POINT' ... END Or LAYER TYPE POINT ... PROCESSING_OPTION NATIVE_FILTER=OGR_GEOMETRY='POINT' ... END HTH ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] queryByLayer - is it a valid method on layerObj?
All, The Mapscript SWIG interface on the layerObj defines a queryByFilter method as public int queryByFilter(mapObj map, string arg1) where arg1 is supposedly the filter to apply when querying the layer, analogous to public int queryByRect(mapObj map, rectObj rect) Where is this method documented? It is not described in either the 6.4 or 7.0 documentation. Based upon the history of the code that I'm attempting to bring back to life the method was probably documented in MapServer 4.x or 5.x. Note that is still visible through SWIG. How should it be used? I tried it with a WFS OGC filter and the log file showed (ignore line wrapping here): [Mon Mar 09 12:18:35 2015].727000 yyparse(): Expression parser error. syntax error [Mon Mar 09 12:18:35 2015].727000 msEvalExpression: Expression parser error. Failed to parse expression: FilterIntersectPropertyNameGeometry/PropertyNamegml:Polygon gml:outerBoundaryIsgml:LinearRinggml:coordinates -88.0865046533,37.143852 -88.0860204771,37.5600435404 -88.0782858287,37.5595392364 -88.0787704736,37.5550101113 -88.0865046533,37.143852 /gml:coordinates/gml:LinearRing/gml:outerBoundaryIs /gml:Polygon/Intersect/Filter I tried with a much simpler mapfile filter and got much the same result: [Mon Mar 09 12:53:22 2015].47 yyparse(): Expression parser error. syntax error [Mon Mar 09 12:53:22 2015].47 msEvalExpression: Expression parser error. Failed to parse expression: ([mukey] in (713970, 713898)) Do any of you have a working example of its use? Is there a way to use the OGC filter directly within mapscript code? That is ultimately what I'm after. Thanks. - Phil Anzel USDA/NRCS contractor - Team Vistronix This electronic message contains information generated by the USDA solely for the intended recipients. Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject the violator to civil or criminal penalties. If you believe you have received this message in error, please notify the sender and delete the email immediately. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] KML in mapserver
Hi, I have a single folder with multiple Placemarks of different geometries in an input KML file. And I want to create a .map file using KML as input source. As mapserver ignores KML styling so i need to give styling in mapserver for each layer. I want to give styling at each placemark. Could you please help me out how to do the same. KML --- ?xml version=1.0 encoding=UTF-8? kml xmlns=http://www.opengis.net/kml/2.2; xmlns:gx= http://www.google.com/kml/ext/2.2; xmlns:kml=http://www.opengis.net/kml/2.2; xmlns:atom=http://www.w3.org/2005/Atom; Document Folder nameFibertech solution/name Placemark nameWestborough MSC - Build/name styleUrl#msn_ylw-pushpin4/styleUrl LineString tessellate1/tessellate coordinates -71.58570500983306,42.28745742866225,0 -71.58563778135751,42.28308954118536,0 -71.58466087108053,42.28307704913402,0 /coordinates /LineString /Placemark Placemark nameWestborough MSC to Westborugh/name styleUrl#msn_ylw-pushpin8/styleUrl LineString tessellate1/tessellate coordinates -71.62172195712955,42.27186897741407,0 -71.6219495552,42.27189433043378,0 -71.6225634332947,42.27210480296427,0 -71.62308968672842,42.27236391420707,0 -71.62394597288645,42.27309147863262,0 -71.62737594489003,42.27740640295431,0 -71.62822373584245,42.27893783334968,0 -71.63091971519079,42.2816476278,0 -71.63207040059587,42.28370221254578,0 -71.62599732629406,42.28418518334991,0 -71.60795611539982,42.28517668969011,0 -71.60267209851122,42.28504601944216,0 -71.60188701357249,42.28516492137062,0 -71.58850360403626,42.28849573666959,0 -71.5858004650346,42.28852197680775,0 -71.58571706491037,42.2874804233345,0 /coordinates /LineString /Placemark Placemark nameNEW Danbury/name Camera longitude-73.45375129836707/longitude latitude41.390460041635/latitude altitude419.0806930250601/altitude heading13.43312150541231/heading tilt28.58299225276625/tilt roll-0.685026358787494/roll gx:altitudeModerelativeToSeaFloor/gx:altitudeMode /Camera styleUrl#msn_ylw-stars/styleUrl Point gx:drawOrder1/gx:drawOrder coordinates-73.45404626023216,41.3929335947184,0/coordinates /Point /Placemark Placemark nameNEW Scotland Amp/name LookAt longitude-72.09703050755105/longitude latitude41.69579944328172/latitude altitude0/altitude heading-0.790587312931665/heading tilt19.0106770482321/tilt range445.0511788150669/range gx:altitudeModerelativeToSeaFloor/gx:altitudeMode /LookAt styleUrl#msn_ylw-stars/styleUrl Point gx:drawOrder1/gx:drawOrder coordinates-72.09643061038489,41.6960553015771,0/coordinates /Point /Placemark /Folder /Document /kml MAP -- MAP NAME QGIS-MAP # Map image size SIZE 500 400 UNITS meters EXTENT -73.454046 41.392934 -71.584661 42.288522 #FONTSET './fonts/fonts.txt' SYMBOLSET 'symbols.txt' #PROJECTION # 'proj=longlat' # 'datum=WGS84' # 'no_defs' #END PROJECTION init=epsg:4326 END # Background color for the map canvas -- change as desired IMAGECOLOR 255 255 255 IMAGEQUALITY 95 IMAGETYPE png OUTPUTFORMAT NAME png DRIVER GD/PNG MIMETYPE image/png IMAGEMODE RGBA EXTENSION png TRANSPARENT ON END # Legend LEGEND IMAGECOLOR 255 255 255 STATUS ON KEYSIZE 18 12 LABEL TYPE BITMAP SIZE MEDIUM COLOR 0 0 89 END END # Web interface definition. Only the template parameter # is required to display a map. See MapServer documentation WEB # Set IMAGEPATH to the path where MapServer should # write its output. IMAGEPATH /tmp/ms_tmp/ # Set IMAGEURL to the url that points to IMAGEPATH # as defined in your web server configuration IMAGEURL /ms_tmp/ # WMS server settings METADATA wms_enable_request * wms_srs EPSG:900913 EPSG:4326 EPSG:3857 EPSG:2154 EPSG:310642901 EPSG:4171 EPSG:310024802 EPSG:310915814 EPSG:310486805 EPSG:310702807 EPSG:310700806 EPSG:310547809 EPSG:310706808 EPSG:310642810 EPSG:310642801 EPSG:310642812 EPSG:310032811 EPSG:310642813 EPSG:2986 labelcache_map_edge_buffer -10 wms_title osm fiber data wms_onlineresource http://haxv-onecontrol-154/cgi-bin/mapserv?; ows_sld_enable true END #Scale range at which web interface will operate # Template and header/footer settings # Only the template parameter is required to display a map. See MapServer documentation #TEMPLATE 'fooOnlyForWMSGetFeatureInfo' END # Start of LAYER DEFINITIONS - LAYER NAME kml_line TYPE LINE STATUS ON CONNECTIONTYPE OGR CONNECTION doc_test.kml DATA SELECT * FROM 'Fibertech solution' WHERE OGR_GEOMETRY='LINESTRING' LABELITEM NAME CLASS NAME Fiber Data STYLE COLOR 250 0 0 OUTLINECOLOR 255 255 255 SIZE 6 END LABEL SIZE GIANT COLOR 0 0 0 OUTLINECOLOR 255 255 255 POSITION AUTO END END END # # Start of LAYER DEFINITIONS - LAYER NAME kml_point