Fred,<br><br>Check if your source table is being read correctly.<br>Use ogrinfo.<br><span style="font-family: courier new,monospace;">ogrinfo -al "MSSQL:server=ELMER;database=HT_2011_10;trusted_connection=yes"</span><br>
<br>OGR doesn't read the MSSQL geometries if the source table doesn't have an
entry in the geometry_columns table. You can bypass this by using the
'Tables' parameter in the connection string[1].<br>
<br>[1]: <a href="http://www.gdal.org/ogr/drv_mssqlspatial.html">http://www.gdal.org/ogr/drv_mssqlspatial.html</a><br><br><div class="gmail_quote">On Thu, Nov 17, 2011 at 9:28 PM, Fred Jones <span dir="ltr"><<a href="mailto:fredjonze@gmail.com">fredjonze@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div>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.</div>
<div> </div>
<div>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" <br>
</div>
<div>The geometry_columns table is:</div>
<div> </div>
<div>f_table_catalog f_table_schema f_table_name f_geometry_column coord_dimension srid geometry_type<br>CENSUS_2010 dbo btcsublocs ogr_geometry 2 4326 GEOMETRY</div>
<div><br><font color="#888888">Fred</font></div><div><div></div><div class="h5">
<div> </div>
<div class="gmail_quote">On Thu, Nov 17, 2011 at 1:48 AM, Luca Sigfrido Percich <span dir="ltr"><<a href="mailto:sigfrido@tiscali.it" target="_blank">sigfrido@tiscali.it</a>></span> wrote:<br>
<blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;" class="gmail_quote">Hi Fred,<br><br>Il giorno mer, 16/11/2011 alle 10.11 -0700, Fred Jones ha scritto:<br>
<div>> Hi Sig,<br>><br>> I have a SQL table temp_sublocs_btc with the MT State Plane x and y as<br>> the first columns in the table. CENSUS_2010 is a sql spatial database.<br>><br>> This is the command I have so far. When I execute it, I just get the<br>
> help returned, no error:<br>><br>> ogr2ogr -overwrite -s_srs EPSG:32100 -t_srs EPSG:4326 -f<br>> "MSSQL:server=ELMER;database=CENSUS_2010;trusted_connection=yes"<br>> "MSSQL:server=ELMER;database=HT_2010_10;tables=temp_sublocs_btc;trusted_connection=yes"<br>
><br>> What am I doing wrong?<br><br></div>Please remember to always post the error messages otherwise we won't be<br>able to understand. Before the usege text you should see an error<br>message.<br><br>I never worked with ogr and MSSQL, but I guess that the problem is that<br>
you should separate the output format specification (-f "MSSQL") and<br>the server connection string.<br><br>Try:<br>
<div><br>ogr2ogr -overwrite -s_srs EPSG:32100 -t_srs EPSG:4326 -f "MSSQL"<br>"MSSQL:server=ELMER;database=CENSUS_2010;trusted_connection=yes"<br>"MSSQL:server=ELMER;database=HT_2010_10;tables=temp_sublocs_btc;trusted_connection=yes"<br>
<br></div>assuming that tables=temp_sublocs_btc allows you to select the input<br>layer.<br><br>Regarding the creation of point, in PostGIS I would simply insert the X<br>and Y coords in two float fields of the target table, and issue a<br>
<br>update CENSUS_2010.temp_sublocs_btc set geom =<br>ST_Transform(ST_SetSRID(ST_MakePoint(x, y), 32100), 4326)<br><br>Which means create a point with x, y, set its SRID to state plane, then<br>transform it into WGS84, then store it in the geom column of your table<br>
(the geometry column of which should have been created in WGS84 SRS).<br><br>I don't know the corresponding function in MSSQL for ST_MakePoint etc...<br>you should refer to the documentation<br><br>I never tried this! I don't know if you can do the transformation<br>
directly with the -sql clause of ogr2ogr or with other options, please<br>try and let us know.<br><br>Sig<br><br><br><br><br><br><br><br><br>_____________<br>PRIVACY<br>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).<br>
<br>PRIVACY<br>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).<br>
</blockquote></div><br>
</div></div><br>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></blockquote></div><br><br clear="all"><br>-- <br>Best regards,<br>Chaitanya kumar CH.<br>
<br>+91-9494447584<br>17.2416N 80.1426E<br>