WMS Web portal

Topics: SharpMap Project, SharpMap v0.9 / v1.x, Web Controls
Feb 14, 2012 at 3:57 AM

Hi, all!

I need an advice, how can I realize WMS Web portal based on SharpMap using:

  • my prepared tiled layers (for example MBTiles);
  • possability to select feature for get information;

I think I can use OpenLayer project, but I don't know how to realize this 2 points.

Developer
Feb 14, 2012 at 6:45 AM
Edited Feb 14, 2012 at 6:45 AM

If you take a look at the trunk there are some samples (very trivial) using openlayers:

1) Start SharpMap.Demo.Wms project and browse to home/openlayers: here a functional WMS server with GetFeatureInfo capabilities

2) Start SharpMap.Demo.Wms project and browse to home/geojson: here you can draw a rectangle and obtain a vectorial layer for your selection.

Both methods give you information about features, so the point 2 can be achieved.

For point 1, I think that you can display MBTiles data working with sharpmap TileLayer or using BruTile, but I home that something can add more useful info.

Feb 15, 2012 at 3:37 AM
Edited Feb 15, 2012 at 11:44 AM

D_Guidi, thanx for reply!

Feb 15, 2012 at 3:49 AM

Maybe I have decision!!!

http://brutile.codeplex.com/discussions/271061

Feb 15, 2012 at 11:41 AM
Edited Feb 15, 2012 at 11:43 AM

Big thanks to FObermaier for BruTile.MbTiles!!!

But I can't realize MbTiles in SharpMap.Demo.Wms project :(

Any help would be appreciated.

Developer
Feb 15, 2012 at 1:22 PM
nigr0nyx wrote:

Big thanks to FObermaier for BruTile.MbTiles!!!

But I can't realize MbTiles in SharpMap.Demo.Wms project :(

Any help would be appreciated.

Actually I don't have seen this code, but I can imagine it's some kind of new provider for sharpmap, so you can configure it exactly like other layers.

Clientside you may not see any difference.

Coordinator
Feb 15, 2012 at 1:46 PM

try this

  1. Reference BruTile.MbTiles
  2. Create your TileLayer using a command similar to this:
    var tileLayer = new TileLayer(new BruTile.MbTilesTileSource("the path to your mbtiles file", "MbTilesLayerName"));

You may want to modify TileLayer not to create a MemoryCache since that is double effort.

Hth FObermaier

Editor
Feb 15, 2012 at 3:04 PM

D_Guidi

Great samples on WMS and OpenLayers.

Very helpful, thanks !

Feb 16, 2012 at 12:00 PM
FObermaier wrote:

try this

  1. Reference BruTile.MbTiles
  2. Create your TileLayer using a command similar to this:
    var tileLayer = new TileLayer(new BruTile.MbTilesTileSource("the path to your mbtiles file", "MbTilesLayerName"));

You may want to modify TileLayer not to create a MemoryCache since that is double effort.

Hth FObermaier

It works, thanks!

Feb 29, 2012 at 9:38 AM
Edited Feb 29, 2012 at 9:39 AM

I need a help!

I'm using WMSGetFeatureInfo control from OpenLayer. It works, but I can't get selected features  as geometry format, 

function showInfo(evt) 
{
 if (evt.features && evt.features.length)  
     {
        document.getElementById('MapInfo').innerHTML = evt.features.length;   <----- I need this case(!) 
     }
 else
     { 
        document.getElementById('MapInfo').innerHTML = evt.text;   <----  BUT I ALWAYS GET HERE
     }
}

What do I need to change in SharpMap.Web.Wms.WMSServer.cs?
Developer
Feb 29, 2012 at 11:15 AM

can you share the WMSGetFeatureInfo object configuration AND the http request you made?

at least you must set info_format as text/json

http://lists.osgeo.org/pipermail/openlayers-users/2010-June/018002.html

BTW I'm not sure that FEATUREINFO requests in json are supported right now.

Feb 29, 2012 at 11:42 AM
Edited Feb 29, 2012 at 11:43 AM

infoControls = { click: new OpenLayers.Control.WMSGetFeatureInfo({ info_format: 'text/json', title: 'Identify features by clicking', layers: [cosmeticLayer], queryVisible: true }) };

but in WMSServer, context.Request.Params["INFO_FORMAT"] is aqual to "text/html"

Developer
Feb 29, 2012 at 1:16 PM
Edited Feb 29, 2012 at 4:13 PM

here: http://lists.osgeo.org/pipermail/openlayers-users/2010-June/018002.html

 

new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://10.0.80.41:7004/geoserver/wms',
title: 'Identify features by clicking',
layers: [network_wms],
queryVisible: true,
vendorParams: {
version: "1.1.1",
info_format: "text/json",
},
format : new OpenLayers.Format.GeoJSON()})

PS: let me be clear. I don't know if sharpmap wms server supports json for featureinfo requests (I need to verify this), but if the http request that openlayers generates (and that you can see using fiddler or firebug) doesn't contain a FEATURE_INFO=text/json parameter, of course any kind of server (like geoserver/mapserver/sharpmap) will return a textual representation