fastest way to convert lon-lat to points

P Kishor punkish at EIDESIS.ORG
Thu Jul 20 08:19:06 EDT 2006


Folks,

I have seen this question asked in the past, and have a similar
problem. I want to convert many lon-lat to a shapefile of points
quickly. The lon-lat are in a csv text file (values.txt) like so

foo,bar,baz,long,lat,qux
1, bar1, baz1, -87.796341, 41.907504, s10
...
...

So, I installed FW_Tools 1.05, created a DSN out of the text file
(this is and has to be on a Windows box), and ogrinfo happily gave me
information that I wanted, but with a twist...

OGRFeature(values.txt):1056
  foo (Integer) = 1
  bar(String) = ba1
  baz(String) = baz1
  long (Real) = -87.796341
  lat (Real) = 41.907504
  qux(String) = 10.0000

So, what's with interpreting qux? It converted my "s10" into a string
of value "10.0000".

Anyway, then I created an OVF file (values.ovf) like so

<OGRVRTDataSource>
  <OGRVRTLayer  name="values">
  <SrcDataSource>ODBC:values</SrcDataSource>
  <SrcLayer>values.txt</SrcLayer>
  <GeometryField encoding="PointFromColumns" x="Long" y="Lat"/>
  <GeometryType>wkbPoint</GeometryType>
  </OGRVRTLayer>
</OGRVRTDataSource>

well,

ogr2ogr -f "ESRI Shapefile" . values.ovf values

but while that seemed to do something without any error, I got no output.

So, is what I am doing the right way of going about this? Is there a
better or another way to try out and benchmark? Oh, did I mention? --
The values.txt file has about 5.25 million rows, so speed is
important.


-- 
Puneet Kishor http://punkish.eidesis.org/
Nelson Inst. for Env. Studies, UW-Madison http://www.ies.wisc.edu/
Open Source Geospatial Foundation https://edu.osgeo.org/



More information about the mapserver-users mailing list