[GRASS-SVN] r44719 - in grass/trunk: include/Make lib/vector/Vlib
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Dec 25 11:11:50 EST 2010
Author: martinl
Date: 2010-12-25 08:11:50 -0800 (Sat, 25 Dec 2010)
New Revision: 44719
Modified:
grass/trunk/include/Make/Grass.make
grass/trunk/lib/vector/Vlib/open_ogr.c
Log:
vlib: create ogr with spatial reference
Modified: grass/trunk/include/Make/Grass.make
===================================================================
--- grass/trunk/include/Make/Grass.make 2010-12-25 15:54:16 UTC (rev 44718)
+++ grass/trunk/include/Make/Grass.make 2010-12-25 16:11:50 UTC (rev 44719)
@@ -221,7 +221,7 @@
STATSDEPS = $(RASTERLIB) $(GISLIB) $(MATHLIB) # NB: doesn't use libgis directly
SYMBDEPS = $(GISLIB) $(MATHLIB)
TRANSDEPS = $(MATHLIB)
-VECTORDEPS = $(DBMILIB) $(GRAPHLIB) $(DIG2LIB) $(LINKMLIB) $(RTREELIB) $(GISLIB) $(GEOSLIBS) $(GDALLIBS) $(MATHLIB) $(BTREE2LIB)
+VECTORDEPS = $(DBMILIB) $(GRAPHLIB) $(DIG2LIB) $(LINKMLIB) $(RTREELIB) $(GISLIB) $(GEOSLIBS) $(GDALLIBS) $(MATHLIB) $(BTREE2LIB) $(GPROJDEP)
VEDITDEPS = $(VECTORLIB) $(DBMILIB) $(GISLIB) $(MATHLIB)
NETADEPS = $(VECTORDEP) $(DBMIDEP) $(GISDEP)
@@ -278,8 +278,8 @@
DBMILIB = $(DBMICLIENTLIB) $(DBMIBASELIB) $(DBMIEXTRALIB)
GEOMLIB = $(OPTRILIB) $(SOSLIB) $(LIALIB) $(BASICLIB)
-VECTLIB = $(VECTORLIB) $(DIG2LIB) $(GRAPHLIB) $(RTREELIB) $(LINKMLIB) $(DBMILIB) $(BTREE2LIB)
+VECTLIB = $(VECTORLIB) $(DIG2LIB) $(GRAPHLIB) $(RTREELIB) $(LINKMLIB) $(DBMILIB) $(BTREE2LIB) $(GPROJLIB)
DBMIDEP = $(DBMICLIENTDEP) $(DBMIBASEDEP)
GEOMDEP = $(OPTRIDEP) $(SOSDEP) $(LIADEP) $(BASICDEP)
-VECTDEP = $(VECTORDEP) $(DIG2DEP) $(GRAPHDEP) $(RTREEDEP) $(LINKMDEP) $(DBMIDEP)
+VECTDEP = $(VECTORDEP) $(DIG2DEP) $(GRAPHDEP) $(RTREEDEP) $(LINKMDEP) $(DBMIDEP) $(GPROJDEP)
Modified: grass/trunk/lib/vector/Vlib/open_ogr.c
===================================================================
--- grass/trunk/lib/vector/Vlib/open_ogr.c 2010-12-25 15:54:16 UTC (rev 44718)
+++ grass/trunk/lib/vector/Vlib/open_ogr.c 2010-12-25 16:11:50 UTC (rev 44719)
@@ -21,8 +21,9 @@
#include <sys/types.h>
#include <sys/stat.h>
+#include <grass/gis.h>
#include <grass/vector.h>
-#include <grass/gis.h>
+#include <grass/gprojects.h>
#include <grass/glocale.h>
#ifdef HAVE_OGR
@@ -217,6 +218,10 @@
OGRLayerH Ogr_layer;
OGRFeatureDefnH Ogr_featuredefn;
+ OGRSpatialReferenceH Ogr_spatial_ref;
+
+ struct Key_Value *projinfo, *projunits;
+
int i, nlayers;
char **Ogr_layer_options;
@@ -264,10 +269,12 @@
}
/* create new OGR layer */
- /* TODO: spatial reference */
+ projinfo = G_get_projinfo();
+ projunits = G_get_projunits();
+ Ogr_spatial_ref = GPJ_grass_to_osr(projinfo, projunits);
/* Ogr_layer_options = CSLSetNameValue(Ogr_layer_options, "OVERWRITE", "YES"); */
Ogr_layer = OGR_DS_CreateLayer(Ogr_ds, Map->fInfo.ogr.layer_name,
- NULL, wkbPoint, Ogr_layer_options);
+ Ogr_spatial_ref, wkbPoint, Ogr_layer_options);
CSLDestroy(Ogr_layer_options);
if (!Ogr_layer) {
G_warning(_("Unable to create OGR layer <%s> in '%s'"),
More information about the grass-commit
mailing list