[Gdal-dev] OGR transforms

Curt, WE7U archer at eskimo.com
Thu Oct 14 16:58:16 EDT 2004


On Thu, 14 Oct 2004, Curt, WE7U wrote:

> Ok.  Our code already uses libgeotiff/libshp/libproj and I'm used to
> installing that set of files into proj for that, but didn't install
> them into the CVS GDAL that I'm trying to use now.  I'd assumed
> they'd be in CVS as well.  Thanks.

Looks like GDAL doesn't include proj.  My memory was just fuzzy on
which libs are in there.

Recompiled proj.4.  Files were already in there.  Recompiled CVS
GDAL.  Recompiled Xastir.  Same errors.

Is there a tutorial/example code somewhere on the minimum necessary
steps in order to create a boundary rectangle for use in spatial
filtering?  It's likely that the steps I took were not sufficient.
The filtering appears to work with the Shapefiles I've tried, but
not with SDTS files.

It appears to be this particular OCTTransform() that is causing the
warnings spelled out earlier.  I'll try the latest release of GDAL
to see if the warnings go away.


  if (reverse_transformH) {
    // Convert our view coordinates from WGS84 to this map
    // layer's coordinates.
//  if (!OCTTransform(reverse_transformH, 2, ViewX, ViewY, ViewZ)) {
    if (!OCTTransform(reverse_transformH, 2, ViewX, ViewY, NULL)) {
      fprintf(stderr,
        "Couldn't convert points from WGS84 to map's spatial reference\n");
    }
    OCTDestroyCoordinateTransformation(reverse_transformH);
    reverse_transformH = NULL;
  }

  // Add these converted points to the spatial_filter_geometry so
  // that we can set our spatial filter in the layer loop below.
  // Snag the spatial reference from the map dataset 'cuz they
  // should match now.
  //
  spatial_filter_geometryH = OGR_G_CreateGeometry(2); // LineString Type

  // Use the map spatial geometry so that we match the map
  OGR_G_AssignSpatialReference(spatial_filter_geometryH, map_spatialH);

  // Add the converted corners of the viewport
  OGR_G_AddPoint(spatial_filter_geometryH, ViewX[0], ViewY[0], ViewZ[0]);
  OGR_G_AddPoint(spatial_filter_geometryH, ViewX[0], ViewY[1], ViewZ[1]);
  OGR_G_AddPoint(spatial_filter_geometryH, ViewX[1], ViewY[1], ViewZ[0]);
  OGR_G_AddPoint(spatial_filter_geometryH, ViewX[1], ViewY[0], ViewZ[1]);

// Establishing this filter causes problems with SDTS contours at
// present (they disappear).
//  OGR_L_SetSpatialFilter( layerH, spatial_filter_geometryH);



--
Curt, WE7U			         http://www.eskimo.com/~archer
"Lotto:    A tax on people who are bad at math." -- unknown
"Windows:  Microsoft's tax on computer illiterates." -- WE7U
"The world DOES revolve around me:  I picked the coordinate system!"



More information about the Gdal-dev mailing list