[gdal-dev] Ogr2ogr

Fred Jones fredjonze at gmail.com
Thu Nov 17 10:58:49 EST 2011


This is what I have so far. Back to where I started. The table is created
in CENSUS_2010 spatial database, but the ogr_geometry column is null. No
error.

ogr2ogr -overwrite -s_srs EPSG:32002 -t_srs EPSG:4326 -f MSSQLSpatial
"MSSQL:server=ELMER;database=CENSUS_2010;;trusted_connection=yes"
"MSSQL:server=ELMER;database=HT_2011_10;trusted_connection=yes" -sql
"SELECT xloc,yloc, spid FROM  dbo.qaBtcSubLocs" -nln "btcSubLocs"
The geometry_columns table is:

f_table_catalog f_table_schema f_table_name f_geometry_column
coord_dimension srid geometry_type
CENSUS_2010     dbo      btcsublocs      ogr_geometry      2
4326        GEOMETRY

Fred

On Thu, Nov 17, 2011 at 1:48 AM, Luca Sigfrido Percich
<sigfrido at tiscali.it>wrote:

> Hi Fred,
>
> Il giorno mer, 16/11/2011 alle 10.11 -0700, Fred Jones ha scritto:
> > Hi Sig,
> >
> > I have a SQL table temp_sublocs_btc with the MT State Plane x and y as
> > the first columns in the table. CENSUS_2010 is a sql spatial database.
> >
> > This is the command I have so far. When I execute it, I just get the
> > help returned, no error:
> >
> > ogr2ogr -overwrite -s_srs EPSG:32100 -t_srs EPSG:4326 -f
> > "MSSQL:server=ELMER;database=CENSUS_2010;trusted_connection=yes"
> >
> "MSSQL:server=ELMER;database=HT_2010_10;tables=temp_sublocs_btc;trusted_connection=yes"
> >
> > What am I doing wrong?
>
> Please remember to always post the error messages otherwise we won't be
> able to understand. Before the usege text you should see an error
> message.
>
> I never worked with ogr and MSSQL, but I guess that the problem is that
> you should separate the output format specification (-f "MSSQL")  and
> the server connection string.
>
> Try:
>
> ogr2ogr -overwrite -s_srs EPSG:32100 -t_srs EPSG:4326 -f "MSSQL"
> "MSSQL:server=ELMER;database=CENSUS_2010;trusted_connection=yes"
>
> "MSSQL:server=ELMER;database=HT_2010_10;tables=temp_sublocs_btc;trusted_connection=yes"
>
> assuming that tables=temp_sublocs_btc allows you to select the input
> layer.
>
> Regarding the creation of point, in PostGIS I would simply insert the X
> and Y coords in two float fields of the target table, and issue a
>
> update CENSUS_2010.temp_sublocs_btc set geom =
> ST_Transform(ST_SetSRID(ST_MakePoint(x, y), 32100), 4326)
>
> Which means create a point with x, y, set its SRID to state plane, then
> transform it into WGS84, then store it in the geom column of your table
> (the geometry column of which should have been created in WGS84 SRS).
>
> I don't know the corresponding function in MSSQL for ST_MakePoint etc...
> you should refer to the documentation
>
> I never tried this! I don't know if you can do the transformation
> directly with the -sql clause of ogr2ogr or with other options, please
> try and let us know.
>
> Sig
>
>
>
>
>
>
>
>
> _____________
> PRIVACY
> Le informazioni contenute in questo messaggio sono riservate e
> confidenziali. Il loro utilizzo e' consentito esclusivamente al
> destinatario del messaggio, per le finalità indicate nel messaggio stesso.
> Qualora Lei non fosse la persona a cui il presente messaggio è destinato,
> La invitiamo ad eliminarlo dal Suo Sistema e a distruggere le varie copie o
> stampe, dandone gentilmente comunicazione all’indirizzo mail del mittente.
> Ogni utilizzo improprio e' contrario ai principi del D.lgs 196/03 e alla
> legislazione europea (Direttiva 2002/58/CE).
>
> PRIVACY
> Le informazioni contenute in questo messaggio sono riservate e
> confidenziali. Il loro utilizzo e' consentito esclusivamente al
> destinatario del messaggio, per le finalità indicate nel messaggio stesso.
> Qualora Lei non fosse la persona a cui il presente messaggio è destinato,
> La invitiamo ad eliminarlo dal Suo Sistema e a distruggere le varie copie o
> stampe, dandone gentilmente comunicazione all’indirizzo mail del mittente.
> Ogni utilizzo improprio e' contrario ai principi del D.lgs 196/03 e alla
> legislazione europea (Direttiva 2002/58/CE).
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20111117/bd094ddc/attachment.html


More information about the gdal-dev mailing list