[mapserver-users] MapServer and shapefile

Fabio Brolese fabiobrolese-forum at yahoo.it
Thu Oct 11 01:52:41 PDT 2012


Ok folks,
I used your suggestions and addede some configurations to the map files:

    MAP
        ......
        SHAPEFILE /gis/ms5/etc/shapefile
        .....
    END

    LAYER
        NAME "level_04"
        TYPE POLYGON
        DATA SITIREN_CARTO_LEVEL04
        STATUS ON
        CLASS
            NAME "Level 04"
            OUTLINECOLOR 0 0 0
        END
    END

In the HTML page, in the function for the onReady event:

        map.addLayer( new OpenLayers.Layer.WMS("level_04", mapserver_url, {
                        layers: "level_04", 
                        format: "image/png", 
                        singleTile: true,
                        isBaseLayer: true
                    },{
                        visibility: true
                    }
                )
            );   


I have also 2 OpenLayers.Layer.TMS defined and they are shown in the menù layer with exclusive radio buttons and they are set as base layer. All the other layers are defined as OpenLayers.Layer.WMS and associated one to onet with a menù leaf. The problem I'm encountering is: the new layer that point to a shapefile isn't shown anywhere so I can't use it. I think the code is correct because I have no errors on page loading.

What I'm doing wrong?

TIA

Fabio






>________________________________
> Da: Mr. Puneet Kishor <punk.kish at gmail.com>
>A: "mapserver-users at lists.osgeo.org" <mapserver-users at lists.osgeo.org> 
>Cc: Fabio Brolese <fabiobrolese-forum at yahoo.it> 
>Inviato: Venerdì 5 Ottobre 2012 8:34
>Oggetto: Re: [mapserver-users] MapServer and shapefile
> 
>
>On Oct 4, 2012, at 10:56 PM, Fabio Brolese <fabiobrolese-forum at yahoo.it> wrote:
>
>> Trying using shapefile as base layer I didn't find where to put my shapefile and to let them seen by MapServer. The examples say me to set the map file correctly but not where to save the shp files how to say to MapServer where thay are. Is there a directive in the main map file where to set the location of shp files like I set the log file path and etc.
>> 
>> 
>
>http://mapserver.org/mapfile/map.html
>
>MAP
>  SHAPEPATH [filename]
>    Path to the directory holding the shapefiles or tiles. 
>    There can be further subdirectories under SHAPEPATH.
>
>
>
>
>http://mapserver.org/mapfile/layer.html
>
>LAYER
>  DATA [filename]|[sde parameters][postgis table/column][oracle table/column]
>    Full filename of the spatial data to process. No file 
>    extension is necessary for shapefiles. Can be specified 
>    relative to the SHAPEPATH option from the Map Object.
>
>
>
>
>
>
>> 
>> 
>> 
>> 
>> 
>>> ________________________________
>>> Da: Cristiano Sumariva <sumariva at gmail.com>
>>> A: Fabio Brolese <fabiobrolese-forum at yahoo.it> 
>>> Inviato: Martedì 2 Ottobre 2012 13:14
>>> Oggetto: Re: [mapserver-users] MapServer and shapefile
>>> 
>>> 
>>> If your map vector is not huge, and processing time is not a problem - something greater then a few seconds for a tile - you can use a WMS layer as base.
>>> Just add isBaseLayer true to parameter options on layer.
>>> This should be minimal to change.
>>> At my sites I did not note WMS overhead on requests.
>>> You should know that OpenLayers is greed and will issue several concurrent requests to server. Processing spikes will happen.
>>> 
>>> 
>>> For larger sets you maybe at the need of some cache stuff.
>>> Consider using one in a programming language you know in case you need do maintenance in source code.
>>> Or if confortable with some, create your particular simple cache maybe an option.
>>> 
>>> 
>>> 2012/10/2 Fabio Brolese <fabiobrolese-forum at yahoo.it>
>>> 
>>> Yes, sorry, I was talking about OpenLayers.
>>>> I understood and is like I did with all the layers I set pointing on PostGIS. I have also a "base layer" set as OpenLayers.Layer.TMS that load image tiles to show the city map. What we want to do is to change the base layer to read the city map from shapfile instead of reading image tiles.
>>>> 
>>>> 
>>>> Do you know if there is a way to do what we want or do I have to reconsider my structure and consider and use it as OpenLayers.Layer.WMS?
>>>> 
>>>> 
>>>> Fabio
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> ________________________________
>>>>> Da: Rahkonen Jukka <Jukka.Rahkonen at mmmtike.fi>
>>>>> A: "mapserver-users at lists.osgeo.org" <mapserver-users at lists.osgeo.org> 
>>>>> Inviato: Martedì 2 Ottobre 2012 9:05
>>>>> Oggetto: Re: [mapserver-users] MapServer and shapefile
>>>>> 
>>>>> 
>>>>> Hi,
>>>>> 
>>>>> Because you talk about base layer I think that you are perhaps going to show your map in OpenLayers. If that is the case then the answer is yes and this OpenLayers example shows how it can be done.
>>>>> http://dev.openlayers.org/releases/OpenLayers-2.12/examples/wms-untiled.html
>>>>> On the Mapserver side you must configure a WMS layer that is using shapefile as
>> input data.
>>>>> http://www.mapserver.org/ogc/wms_server.html
>>>>> 
>>>>> 
>>>>> -Jukka Rahkonen-
>>>>> ________________________________
>>>>> Fabio Brolese wrote:
>>>>> 
>>>>>> Hello everybody,
>>>>>> after a long search on Google I'm here to ask you if it's possible to use a shapefile as base layer.
>>>>>> Everything I found was on exporting to shapefile or drawing objects from shapefile but nothing saying that I can >use it as base layer.
>>>>> 
>>>>> Can anyone help me?
>>>>> 
>>>>> TIA
>>>>> 
>>>>> Fabio
>>>>> _______________________________________________
>>>>> mapserver-users mailing list
>>>>> mapserver-users at lists.osgeo.org
>>>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>>>> 
>>>>> 
>>>>> 
>>>> _______________________________________________
>>>> mapserver-users mailing list
>>>> mapserver-users at lists.osgeo.org
>>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>>> 
>>>> 
>>> 
>>> 
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20121011/7d3e4d62/attachment-0001.html>


More information about the mapserver-users mailing list