I have a CSV file with the following structure:
id,Geometry
0,MULTIPOLYGON(((343362.10597 7395133.999035, 343362.608646 7395137.592628, 343366.027235 7395138.714539, 343389.482792 7395141.302312, 343390.91157 7395141.3619, 343408.443301 7395142.225044, 343424.796266 7395143.518546, 343427.805771 7395143.750087, 343459.114406 7395151.925896, 343500.691088 7395167.099913, 343533.442931 7395178.768452, 343560.442616 7395188.89142, 343579.337382 7395195.970768, 343607.760736 7395207.592871, 343616.264189 7395206.786678, 343622.432438 7395203.795961, 343628.643546 7395197.749076, 343632.516051 7395190.791227, 343644.108743 7395154.080564, 343650.279907 7395134.566388, 343665.549752 7395091.970019, 343674.153464 7395070.3001, 343684.521723 7395042.103866, 343692.086323 7395023.080773, 343697.664272 7395011.301474, 343704.042755 7395002.000384, 343722.789 7394978.98797, 343737.600949 7394965.856473, 343743.321932 7394960.75674, 343744.156484 7394956.225018, 343740.567359 7394952.90858, 343734.573577 7394954.871254, 343718.491883 7394957.833673, 343704.830423 7394955.971197, 343700.751989 7394955.451426, 343671.508596 7394953.732586, 343656.454855 7394949.352304, 343613.264807 7394936.154904, 343594.698268 7394929.920763, 343581.627559 7394925.329026, 343550.709676 7394913.115351, 343526.554635 7394899.589577, 343478.903537 7394873.940365, 343468.007238 7394863.657216, 343463.622054 7394861.273541, 343459.51688 7394863.256304, 343455.532832 7394867.278113, 343454.991209 7394874.005756, 343454.889219 7394883.540009, 343454.130651 7394913.411519, 343452.278125 7394924.333536, 343448.140323 7394943.681126, 343441.382138 7394972.237009, 343430.693786 7395001.681122, 343425.177072 7395017.259621, 343409.659822 7395056.198477, 343398.087215 7395079.530933, 343391.654566 7395092.9179, 343367.420067 7395126.868407, 343362.10597 7395133.999035)))
1,MULTIPOLYGON(((341753.99139 7396339.857021, 341864.449827 7396365.802449, 341945.003303 7396384.856923, 341974.17656 7396388.616031, 341983.161653 7396389.621122, 342025.201086 7396394.305266, 342072.473769 7396416.499583, 342081.250386 7396416.007268, 342086.252749 7396410.424149, 342135.553505 7396237.879056, 342157.373097 7396136.636069, 342162.163276 7396117.572635, 342167.848504 7396101.675161, 342177.284315 7396088.321013, 342196.099067 7396064.989896, 342199.664712 7396061.008181, 342233.478221 7396032.068704, 342296.775018 7396002.671521, 342179.142305 7396025.834978, 342126.305945 7396050.039647, 342053.755181 7396104.265651, 342037.640031 7396129.098673, 342029.569424 7396140.828401, 342017.999074 7396144.745865, 342010.864372 7396150.173053, 341980.079585 7396256.048079, 341975.091734 7396254.609903, 341963.052807 7396293.418932, 341955.312202 7396308.618598, 341946.724563 7396319.988315, 341932.796812 7396331.33361, 341922.464309 7396339.749661, 341896.858804 7396349.806005, 341877.578455 7396352.82059, 341861.859599 7396352.252155, 341757.173213 7396327.00034, 341753.99139 7396339.857021)))
I'd like to convert CSV files like this to Shapefiles using ogr2ogr
. I've found solutions like this one where it solves the problem when the geometry is just lat and lng. For POINTs, it can be solved like the following:
ogr2ogr -oo X_POSSIBLE_NAMES=Lon* -oo Y_POSSIBLE_NAMES=Lat* -f "ESRI Shapefile" test.shp test.csv
However, my case is different since I have a MULTIPOLYGON geometry asText
on my CSV. How can I use ogr2ogr
to convert CSV files like the one in my first sample to shapefile?
.vrt
file in order to make this convertion. But since I need it for a MULTIPOLYGON it'll differ a little from that question. I'm trying to figure out how to create it here... I didn't find any direct sample of what the.vrt
file should be for my case.