0

I am current developing an GeoExt app which is up and running. Now I want to create maps then dump them in the app. I have been battling with mapServer for days now. Mapfile can generate raster type files without any hustle but i can not do the same with my shapefiles or any other file for that matter. What am I missing. Here is my mapfile code....

MAP
        IMAGETYPE PNG
        NAME "Mapfile"
        EXTENT 15.8278 -35.0547 52.2894 -21.929
        SIZE 2000 1700
    SHAPEPATH "/var/www/html/mapserver/mapfile"
        IMAGECOLOR 128 0 250

        WEB
        Template "/var/www/html/mapserver/mapfile/tamplate.html" #Do not mind the spelling
            IMAGEPATH "/var/www/html/mapserver/outputs/"
            IMAGEURL "../mapserver/outputs/"
        METADATA
                    "wms_title" "Moz_Floods_Before"
                    #"wms_onlineresource" "http://localhost/cgi-bin/mapserv?mode=map&map=/var/www/html/mapserver/mapfile/before.map&"
                    "wms_enable_request" "*"
                    "wms_srs" "EPSG:4326"
        END
        END  
    LAYER
        NAME 'KML_File'  #KML file is the shapefile
        DATA KML_Shape
        STATUS ON
        TYPE POLYGON 
        PROJECTION
                "proj=longlat"
                "ellps=WGS84"
                "datum=WGS84"
                "no_defs"
        END
    END
END

This can only display imagecolor..., I',m working on Linux

  • You have not defined any style for the vector layer. – user30184 May 14 '15 at 8:51
  • Thanks for the reply but that didn't seem to work, do you have a working code for mapserver and share with me maybe that will assist... – user52114 May 14 '15 at 14:35
1

Try below sample (tested). It's possible I missed to remove some parameters not required. You should be able to correct your own issue in the mapfile.

A sample.map file

MAP
  NAME "MAPSERVER QUICKSTART"
  EXTENT -137 29 -53 88
  UNITS DD
  SHAPEPATH "/tmp/"
  SIZE 800 600
  SYMBOLSET "symbols.txt"
  IMAGETYPE PNG24
  PROJECTION
    "init=epsg:4326"
  END
  WEB
    METADATA
      ows_enable_request "*"
    END
  END
  LAYER
    NAME "kml_example"
    TYPE POINT
    STATUS ON
    CONNECTIONTYPE OGR
    CONNECTION "uefa-2012.kml"
    DATA "Layer #0"
    CLASS
      NAME "My Places"
      STYLE
        COLOR 246 241 223
        OUTLINECOLOR 255 0 0
        SYMBOL 'circle'
        SIZE 20
      END
    END
  END
END

The symbols.txt content

SYMBOLSET

SYMBOL
  NAME "circle"
  TYPE ellipse
  FILLED true
  POINTS
    1 1
  END # POINTS
END # SYMBOL

END

The link to kml sample uefa-2012.kml

  • Thanks for the reply, I managed to display the shapefiles and other files except KML, what is the Layer or where is it defined ('Layers #0')... – user52114 May 15 '15 at 10:26
  • Just do an ogrinfo -so uefa-2012.kml and you will see ;) – ThomasG77 May 15 '15 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.