Discussion Forums
September 08, 2010, 06:21:35 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?
Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: how to display the postGIS files  (Read 169 times)
windhello

Posts: 2


« on: July 27, 2010, 07:10:05 am »

hi,
I'm a newer to use the AspMap(for. NET).
I converted  SimpleMapApp's shapefile(the first Demo sample of the C# Samples)  data to the postGIS .But I don't know how to  set the MapPath if  I use the data from postGIS,  the original code of mapfile like this:

private void AddMapLayers()
    {
        string MapFolder = MapPath("MAPS/WORLD/");

        map.AddLayer(MapFolder + "world.shp");
        map.AddLayer(MapFolder + "lakes.shp");
        map.AddLayer(MapFolder + "capitals.shp");

I use the  Visual Studio 2005,postGIS 8.4. C# language.

can someone  show me the details of how to display the postGIS files ?

Thanks in advance.

Logged
amanero

Posts: 23


WWW
« Reply #1 on: July 28, 2010, 07:12:02 am »

I usually work with VB.NET so I'm sorry, but my code is in VB.

Time ago I made a little project to do that; it's code is like this:

        Dim sqlSelect As String = "SELECT name, asBinary(the_geom) AS WkbGeometry FROM public.a0;"
        Dim connectionString As String = "Server=127.0.0.1;Database=callejero;User ID=postgres;password=postgres;"

        Dim adapter As Npgsql.NpgsqlDataAdapter = New Npgsql.NpgsqlDataAdapter(sqlSelect, connectionString)
        Dim dataTable As DataTable = New DataTable()

        adapter.Fill(dataTable)
        adapter.Dispose()

        Dim dbLayer As AspMap.Layer = Map.AddSpatialDataLayer(dataTable, "WkbGeometry")
        dbLayer.Symbol.LineColor = Color.Black
        dbLayer.Symbol.FillColor = Color.LightYellow
        dbLayer.Symbol.FillStyle = AspMap.FillStyle.Solid
Logged
windhello

Posts: 2


« Reply #2 on: August 08, 2010, 09:46:54 pm »

OK, Thanks for your answers
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!