OGR Virtual

Emil Zegers taatuut at PLANET.NL
Thu Feb 9 15:57:28 EST 2006


Hello Mark,

You are correct with your explanation about PROJECTION but since I had this
case last year where I did have to add PROJECTION to an OVF layer although
all data was in the same projection I thought it might be worth trying it.

However, I have not fully test cased this and I don't know enough about the
underlying code to be sure this was the (right) solution to the problem.

Regards,

Emil

-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU]On
Behalf Of Mark Adams
Sent: donderdag 9 februari 2006 21:44
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] OGR Virtual


I will try that. However, my understanding of PROJECTION is that it is not
required unless you have data in more than one projection, or want to
display the data in a projection different from the one the data is in. Is
that not correct?

Thanks.

------------------------------
Mark Adams
Senior Analyst & Project Manager
Cuesta Systems (DPRA Canada)
5230 South Service Road
Burlington, ON L7L 5K2
Phone: 905-333-4544 x14
Fax: 905-333-0455
Email: mark.adams at dpra.com


-----Original Message-----
From: Emil Zegers [mailto:taatuut at planet.nl]
Sent: February 9, 2006 3:41 PM
To: Mark Adams; MAPSERVER-USERS at LISTS.UMN.EDU
Subject: RE: [UMN_MAPSERVER-USERS] OGR Virtual

Hello Mark,

Have you tried adding a PROJECTION to the LAYER containing the ovf file
and/or the ovf file?

Something like:

  LAYER
    NAME "Virtual Parcel"
    DEBUG ON
    STATUS DEFAULT
    CONNECTIONTYPE OGR
    CONNECTION "parcel_test.ovf"
    DATA "parcel_test"
    TYPE POLYGON
    # fill projection parameter, e.g. 28992 for Dutch system
    PROJECTION
	"init=epsg:12345"
    END
    TEMPLATE "null"
    CLASS
      NAME "Virtual Parcel"
      STYLE
        COLOR 255 1 5
        OUTLINECOLOR 168 112 0
      END
    END
  END


In the past I had situations where I needed to put the PROJECTION in the
LAYER and not in the OVF file.

Also, use STATUS DEFAULT for testing purposes so the layer is always on.

Regards,

Emil


-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU]On
Behalf Of Mark Adams
Sent: donderdag 9 februari 2006 21:12
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] OGR Virtual


Hello,

I would like to know if there was ever a successful resolution to Frank's
question below. I am in the same situation: I cannot get the OGR virtual
layer to render on my map.

I have had no problem with points. However when I try to render a virtual
polygon I get no error, just no feature on the map. The other layers all
render without problem. I get no error from OGRINFO either.

I've tried a number of different ways of configuring the OVF file, the
data in the database, and the MAP file. Numerous combinations result
in "success" in the sense of no errors, but still no features.

Here is my most recent attempt:
Connection: I'm using an ODBC connection to an MS Access database. The
ODBC connection is called "parcel_test".

OVF:
<OGRVRTDataSource>
    <OGRVRTLayer name="parcel_test">
        <SrcDataSource>ODBC:parcel_test,PROPERTY_VIRTUAL</SrcDataSource>
  <SrcSQL>SELECT GEOMETRY FROM PROPERTY_VIRTUAL</SrcSQL>
 <GeometryType>wkbPolygon</GeometryType>
 <GeometryField encoding="WKT" field="GEOMETRY"/>
    </OGRVRTLayer>
</OGRVRTDataSource>

MAP:
  LAYER
    NAME "Virtual Parcel"
    DEBUG ON
    STATUS ON
    CONNECTIONTYPE OGR
    CONNECTION "parcel_test.ovf"
    DATA "parcel_test"
    TYPE POLYGON
    TEMPLATE "null"
    CLASS
      NAME "Virtual Parcel"
      STYLE
        COLOR 255 1 5
        OUTLINECOLOR 168 112 0
      END
    END
  END

I've got one record in the PROPERTY_VIRTUAL table, with the GEOMETRY value
set as follows:
POLYGON('501453.34 4800585.97,501576.14 4800590.44,501569.85
4800522,501471.61 4800521.63,501453.34 4800585.97')

I've also tried storing the geometry without the quotes, brackets, and
keyword POLYGON but it doesn't change the result.

I've captured this output when I refresh the map:
msOGRFileOpen(parcel_test.ovf)...
OGROPen
(\\Snow\c_drive\Inetpub\wwwroot\NTGO_GeoPortal\config\..\Data\Shapefiles/pa
rcel_test.ovf)
msOGRLayerClose(parcel_test.ovf).
msOGRFileClose
(\\Snow\c_drive\Inetpub\wwwroot\NTGO_GeoPortal\config\..\Data\Shapefiles/pa
rcel_test.ovf,0).
msDrawMap(): Layer 3 (Virtual Parcel), 0.130s
msDrawMap(): Layer 4 (Property Parcels), 0.101s
msDrawMap(): Layer 6 (Streets), 0.030s
msDrawMap(): Drawing Label Cache, 0.000s
msDrawMap() total time: 0.281s
msOGRFileOpen(parcel_test.ovf)...
OGROPen
(\\Snow\c_drive\Inetpub\wwwroot\NTGO_GeoPortal\config\..\Data\Shapefiles/pa
rcel_test.ovf)
msOGRLayerClose(parcel_test.ovf).
msOGRFileClose
(\\Snow\c_drive\Inetpub\wwwroot\NTGO_GeoPortal\config\..\Data\Shapefiles/pa
rcel_test.ovf,0).
msDrawMap(): Layer 3 (Virtual Parcel), 0.110s
msDrawMap(): Layer 4 (Property Parcels), 0.070s
msDrawMap(): Layer 6 (Streets), 0.030s
msDrawMap(): Drawing Label Cache, 0.000s
msDrawMap() total time: 0.220s

>From the FWTools command line I get this:
C:\Program Files\FWTools1.0.0a7>ogrinfo ODBC:parcel_test
INFO: Open of `ODBC:parcel_test'
using driver `ODBC' successful.
1: PROPERTY_VIRTUAL


C:\Program Files\FWTools1.0.0a7>ogrinfo ODBC:parcel_test PROPERTY_VIRTUAL
INFO: Open of `ODBC:parcel_test'
using driver `ODBC' successful.

Layer name: PROPERTY_VIRTUAL
Geometry: Unknown (any)
Feature Count: 1
Layer SRS WKT:
(unknown)
OBJECTID: Integer (10.0)
STATUS: String (20.0)
UTM_X: Real (0.0)
UTM_Y: Real (0.0)
AREA: Real (0.0)
SHAPE_Length: Real (0.0)
SHAPE_Area: Real (0.0)
HERITAGE: String (20.0)
PAR_UPDATE: String (10.0)
UPDATE_DATE: String (20.0)
CREATE_DATE: String (20.0)
UPDATE_SOURCE: String (50.0)
AREA_ACRE: Real (0.0)
PID: Integer (10.0)
AREA_HECTARE: Real (0.0)
OGRFeature(PROPERTY_VIRTUAL):0
  OBJECTID (Integer) = 2
  STATUS (String) = Active
  UTM_X (Real) = 501405.687500125
  UTM_Y (Real) = 4801949.24999883
  AREA (Real) = 229.843703627485
  SHAPE_Length (Real) = 77.3317483960398
  SHAPE_Area (Real) = 229.843703627485
  HERITAGE (String) = PART V
  PAR_UPDATE (String) = (null)
  UPDATE_DATE (String) = (null)
  CREATE_DATE (String) = (null)
  UPDATE_SOURCE (String) = (null)
  AREA_ACRE (Real) = 0.0567943791663515
  PID (Integer) = 42385
  AREA_HECTARE (Real) = 0.0229843703627485

Any help would be greatly appreciated. I have several polygon layers to
publish this way, ultimately from an Oracle database.

Thanks in advance,

------------------------------
Mark Adams
Senior Analyst & Project Manager
Cuesta Systems (DPRA Canada)
5230 South Service Road
Burlington, ON L7L 5K2
Phone: 905-333-4544 x14
Fax: 905-333-0455
Email: mark.adams at dpra.com


On Wed, 21 Dec 2005 00:10:06 -0600, Frank Fica <simbiotico at HOTMAIL.COM>
wrote:

>Hello,
>
>I've been trying to map a non-spatial postgre table with ogr via ODBC but
no success. There must
>be a simple solution to what I'm missing and I haven't been able to
figure it out. My other layers
>do render but my Virtual layer doesn't. When I test in ogrinfo I can
connect but when I try to map
>in mapserver the image is blank, only my mapinfo layer renders.
>
>Does someone has any suggestions on what I'm missing?
>
>Here are is my ovf file:
>
><OGRVRTDataSource>
>    <OGRVRTLayer name="sorento">
>        <SrcDataSource>ODBC:@PostgreSQL,sorento</SrcDataSource>
>        <SrcLayer>sorento</SrcLayer>
>        <GeometryType>wkbPoint</GeometryType>
>        <GeometryField encoding="PointFromColumns" x="Lon" y="Lat"/>
>    </OGRVRTLayer>
></OGRVRTDataSource>
>
>and map file:
>
>MAP
>  IMAGETYPE PNG
>  EXTENT -90.760314 14.252771 -90.210352 14.937117
>  SIZE 640 480
>  UNITS METERS
>
>  SYMBOL
>   NAME "circle"
>   TYPE ELLIPSE
>   POINTS
>    1 1
>   END
>   FILLED TRUE
>  END
>
> LAYER
>  NAME "ciudad"
>  TYPE POLYGON
>  STATUS ON
>  CONNECTIONTYPE OGR
>  CONNECTION "/var/www/html/guatemala/data/ciudad.tab"
>  STYLEITEM "AUTO"
>    CLASS
>      NAME "Ciudad"
>    END
> END
>
> LAYER
>    NAME "sorento"
>    TYPE POINT
>    CONNECTIONTYPE OGR
>    CONNECTION "virtual.ovf"
>    DATA "sorento"
>    STATUS DEFAULT
>    CLASS
>      STYLE
>      SYMBOL 'circle'
>      SIZE 30
>      COLOR 255 0 0
>      END
>     END
> END
>END



More information about the mapserver-users mailing list