1

I can convert shapefile (having points) to CSV file, import in MySQL databases and then i can execute my queries for searching. Now I want to do same for polygon shapefile; that is, I want to convert a shapefile having polygons to CSV and then import in MySQL databases for search purposes.

Is that possible?

Actually i have a geojson file having road polylines. i want to convert this geojson to csv then import in databases and then execute my search queries e-g i want to draw on google map only those roads having length less than 10km etc.

  • Is the goal to get the info from the csv into the database or is it to get the geometry + info from csv into the database? Also, how are you currently converting the point shp to csv? – artwork21 Apr 26 '17 at 12:17
  • QGIS can convert a shapefile to CSV using the right-click 'save as', setting the CSV output format, and in the 'layer options' setting how you want to store the coordinates... but there are also tools in the MySQL GUI to import shapefiles directly to MySQL, you might want to try those too... – DPSSpatial Apr 26 '17 at 16:26
  • i am converting shp file to csv using QGIS, in the csv file i have also coloums for latitude and longitude so when i search in the databases i can draw marker on the google map using that (latitude/longitude) coloums... now the same i want for polygons – ibrahim Apr 27 '17 at 6:23
1

In QGIS, you can use the MMQGIS plugin function "Export Geometry to CSV". This tool would generate WKT for each polygon in the shape file as well as any associated attributes. The process is simple and relatively quick.

0

Try on-line MyGeodata Converter - https://mygeodata.cloud/converter/shp-to-csv. The converter converts polygons to centroids (X and Y columns) during conversion to CSV...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.