[Mapserver-west] Found the answer
Mike
mhlwang at telus.net
Sun May 8 20:11:27 EDT 2005
Hi all,
I've been trying to connect a table(GPS) that contains X,Y coordinates on my
MSDE database to Mapserver. I've followed the instructions on
http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?VirtualSpatialData
Everything is going great so far but when I try to display the layer I get
this error msg:
===========
msDrawMap(): Image handling error. Failed to draw layer named
'MyVirtualLayer'.
msOGRLayerInitItemInfo(): OGR error. Invalid Field name: POINT
===========
Here is my VRT file:
===========
<OGRVRTDataSource>
<OGRVRTLayer name="GPS">
<SrcDataSource>ODBC:HOPE,GPS</SrcDataSource>
<SrcLayer>GPS</SrcLayer>
<GeometryType>wkbPoint</GeometryType>
<LayerSRS>WGS84</LayerSRS>
<GeometryField encoding="PointFromColumns" x="x" y="y"/>
</OGRVRTLayer>
</OGRVRTDataSource>
===========
When I test it using OGR this is what I get:
===========
C:\Inetpub\wwwroot\mhlwang>ogrinfo virtual.ovf
ERROR 4: Update access not supported for VRT datasources.
Had to open data source read-only.
INFO: Open of `virtual.ovf'
using driver `VRT' successful.
1: GPS (Point)
===========
Here is my map file:
===========
MAP
#IMAGETYPE PNG
EXTENT 250565.140625 1309136.875000 434428.468750 1438412.625000
UNITS METERS
SIZE 800 600
SHAPEPATH "data"
IMAGECOLOR 255 255 255
PROJECTION
"proj=utm"
"ellps=evrst30"
"zone=48"
"north"
"no_defs"
# "lat_0=45"
# "lon_0=100"
# Alternatively, you can specify an EPSG code.
#"init=epsg:9808"
#
END
#
# Start of web interface definition (including WMS enabling metadata)
#
WEB
HEADER demo_header.html
TEMPLATE demo.html
FOOTER demo_footer.html
# MINSCALE 1000
# MAXSCALE 1550000
IMAGEPATH "C:\Inetpub\wwwroot\tmp\"
IMAGEURL "/tmp/"
#METADATA
#END
END
# Start of LAYER DEFINITIONS ---------------------------------------------
LAYER # pursat polygon layer begins here
NAME pursat
DATA pursat_srok_bnd
STATUS DEFAULT
TYPE POLYGON
PROJECTION
# "init=epsg:3148"
"proj=utm"
"ellps=evrst30"
"zone=48"
"north"
"no_defs"
END
CLASS
COLOR 255 228 196
OUTLINECOLOR 32 32 32
END
END # States polygon layer ends here
LAYER #begin virtual layer
NAME "MyVirtualLayer"
TYPE POINT
CONNECTIONTYPE OGR
CONNECTION "C:\Inetpub\wwwroot\mhlwang\virtual.ovf"
DATA "GPS" #the name of the OGRVrtLayer
STATUS DEFAULT
LABELITEM 'POINT' #use table.name or just name depending on your OVF
file.
PROJECTION
#"init=epsg:4326"
"proj=utm"
"ellps=evrst30"
"zone=48"
"north"
"no_defs"
END
CLASS
SYMBOL 1
SIZE 6
COLOR 255 0 0
LABEL
SIZE MEDIUM
TYPE BITMAP
COLOR 0 0 0
END
END
END
# End of LAYER DEFINITIONS -------------------------------
END # end of map file/object
===========
I've tried changing the LABELITEM 'POINT' to LABELITEM 'GPS.POINT' but that
doesn't seem to work either.
Any suggestions are welcome! Thanks!
Mike
-----Original Message-----
From: mapserver-west-bounces at lists.maptools.org
[mailto:mapserver-west-bounces at lists.maptools.org] On Behalf Of Tyler
Mitchell
Sent: Thursday, April 21, 2005 6:49 AM
To: mapserver-west at lists.maptools.org
Subject: Re: [Mapserver-west] Found the answer
Good sleuthing Dean.
For those who aren't familiar with the VRT format, it can be used to grab
non-spatial (tabular) lists of coordinates and create point features.
Dean's
example is a good one, using an (any!) ODBC data source that has an x and y
column. I've used this with a CSV data source before and found it worked
great. I think that it can be used with any OGR support data format as
well.
Tyler
On April 20, 2005 10:56 pm, Dean C. Mikkelsen wrote:
> Hi all!
>
> I think I solved my question. I am working possibly with a non-spatial
> database - originally Oracle 8. The hope is to migrate to PostGIS or
> MySQL. I have experience with MySQL.
>
> It appears as though I have to use the Virtual File Format found with
> the OGR. The link is here:
>
> http://www.remotesensing.org/gdal/ogr/drv_vrt.html
>
> In my case, I would have code such as:
> <OGRVRTDataSource>
>
> <OGRVRTLayer name="lease_polygons">
>
> <SrcDataSource>ODBC:gulf_of_mexico,lease_polygons</SrcDataSource>
> <SrcLayer>lease_polygons</SrcLayer>
> <GeometryType> wkbPolygon</GeometryType>
> <LayerSRS>WGS84</LayerSRS>
> <GeometryField encoding="PointFromColumns" x="x" y="y"/>
> </OGRVRTLayer>
>
> </OGRVRTDataSource>
>
> The answer was right in front of me, just a little digging, eh?
>
> Cheers,
> Dean
>
>
>
>
> _______________________________________________
> Mapserver-west mailing list
> Mapserver-west at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/mapserver-west
_______________________________________________
Mapserver-west mailing list
Mapserver-west at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/mapserver-west
More information about the Mapserver-west
mailing list