[mapserver-users] How to integrate Openlayers + MapScript C# + Postgis
Stephen Woodbridge
woodbri at swoodbridge.com
Thu Mar 14 08:17:56 PDT 2013
On 3/14/2013 10:47 AM, Marco Araujo wrote:
> Thanks Stephen,
>
> I believe that it would not to use CGI for I will apply different
> filters on the data map.
> For example, my User can filter the map by rivers, companies, names of
> residents, etc..
This can all be done in WMS by selecting what layers you want.
Create a control on your map based on getting a list of layers via the
getCapabilities document and then use the control to select the layers
request via WMS.
> In some cases, such as streets, will display the map with the selected
> street.
Create a simple .NET ajax handler where you pass the street name and it
returns the extents, then have OpenLayers zoom to that extent.
> I believe that it is not possible to do in CGI. So understand that I
> need to use mapscript.
I assume you are planning to code controls in Javascript to interact
with the user. Rather than write a huge complicated application that has
to simulate WMS, write small quick ajax handlers to get what you need
from the client and have OpenLayers do the work. This is more scalable,
more modular, and probably much easier to design, code, and test.
> How can I get an example to simulate a WMS service to receive the
> parameters of openlayers?
I'm not aware of any, maybe other know and have something they can share.
> Well I'll need to get these parameters in the database (using 'select
> from where params') in order to assemble the map and return to openlayers.
Mapserver support WMS requests and you can parameterize the mapfile. In
OpenLayers you can make WMS requests which already give you most of the
control you mention above, and by knowing that you have additional
parameters that you set in the mapfile (you may not even need to do
that) you can add them to the url.
You need to learn more about OpenLayers and mapserver and WMS. Start
there and figure out how to turn on/off layers and how to work with the
getCapabilities document.
google: openlayers getcapabilities layers
and look at some of these.
-Steve
>
>
> Sincerely,
> Marco
>
>
> > Date: Thu, 14 Mar 2013 10:02:16 -0400
> > From: woodbri at swoodbridge.com
> > To: mapserver-users at lists.osgeo.org
> > Subject: Re: [mapserver-users] How to integrate Openlayers +
> MapScript C# + Postgis
> >
> > On 3/14/2013 9:24 AM, Marco Araujo wrote:
> > > Hi everybody,
> > >
> > > I'm trying to develop an application (ASP.NET C#) that gets the
> database
> > > (postgis) map through conditions "where" and process adjustments by
> > > mapscript and provide the map to be viewed by openlayer.
> >
> > If I understand correctly, you want to use .NET to control what is
> > displayed in the map.
> >
> > First I would make sure that you can not do everything you need using
> > mapserver cgi parameter substitution as this might be much simpler.
> >
> > > Can anyone guide me on how I should proceed?
> >
> > Assuming that the above will not work, then you are going to have to
> > make you mapscript application simulate a WMS service so you can call it
> > from OpenLayers.
> >
> > Now:
> >
> > data ---> mapserver ----> OpenLayers
> >
> > In this you would program in JavaScript and change the url for the map
> > requests to pass parameters and do parameter substitution in the
> > mapfile. This is a standard Web 2.0 approach.
> >
> > With mapscript:
> >
> > data ---> your.net -----> OpenLayers
> >
> > Here you have to simulate a WMS service so you can talk to OpenLayers
> > and then read the parameters from OpenLayers to control your .NET code
> > and how it interacts with mapserver. Since you have to pass parameters
> > to the server anyway, I would start and see if you can do it with the
> > existing mapserver code.
> >
> > -Steve W
> >
> > > I need a WMS (mapserver) to display dynamic data (from database)?
> > >
> > > Already have the following:
> > > 1. up and running MapServer CGI in my Windows2008 (64bits) under
> IIS 7.5
> > > (not apache).
> > >
> > > 2. The database postgis mount but I have no idea how to retrieve
> the data
> > > and presents it in openlayers.
> > >
> > > 3. Tests (successfully) with openlayers presenting a static map of
> > > mapserver as follows:
> > > /layer = new OpenLayers.Layer.WMS("WorldMap",
> > > "http://localhost/MapServer/mapserv.exe?
> > >
> map=C:/maps/itasca.map&mode=map&template=openlayers&layer=lakespy2&layer=dlgstln2");/
> > >
> > > If you can help me I appreciate it.
> > >
> > > Sincerely,
> > > Marco Araujo
> > > Brazil / Sao Paulo
> > >
> > >
> > >
> > > _______________________________________________
> > > 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
>
More information about the MapServer-users
mailing list