Динамический слой карты с C # MapScript от Mapserver - PullRequest
0 голосов
/ 06 мая 2009

Я разрабатываю веб-приложение, которое будет показывать местоположение проекта на карте. У меня есть эта функция добавить данные, которые я хочу показать на слое карты.

protected void AgregarPunto(DataTable result)
{
    layerObj thislayer = util.MSMap.getLayerByName("poi");

    foreach (DataRow dr in result.Rows)
    {
        shapeObj shp = new shapeObj(mapscript.MS_SHP_POINTM);
        shp = shapeObj.fromWKT(dr["the_geom"].ToString());

        thislayer.addFeature(shp);
    }
}

Это было рекомендация ребят из IRC Channel #mapserver. Но это не работает! Может кто-нибудь помочь выяснить, почему очки не показываются ???

1 Ответ

1 голос
/ 23 сентября 2009

Вы создаете classObj и styleObj для своего слоя?

Вот мой пример кода:

myLayer.type = OSGeo.MapServer.MS_LAYER_TYPE.MS_LAYER_LINE;
myLayer.status = 1;
myLayer.symbolscaledenom = 1; 

// Create a mapping class
OSGeo.MapServer.classObj myClass = new OSGeo.MapServer.classObj(myLayer);

// Create a style
OSGeo.MapServer.styleObj style = new OSGeo.MapServer.styleObj(myClass);

// unitColor = new Color(12, 34, 56);
int red = Convert.ToInt32(unitColor.R);
int green = Convert.ToInt32(unitColor.G);
int blue = Convert.ToInt32(unitColor.B);

style.color.setRGB(red, green, blue);

style.outlinecolor.setRGB(255, 255, 255);
//style.symbol = _map.symbolset.index("circle");  // Here '_map' is an instance of mapObj, this line is not strictly necessary 

style.size = 10;
style.minsize = 3; // Change this to your needs
...