Global Mapper v25.0

Export to mysql geographic format

mrpurple
mrpurple Global Mapper User
edited December 2012 in Vector Data
I've been trying to export a bunch of polygons to a mysql ready format.
MYSQL can read in polygons with the following code:
INSERT INTO table_name (column_name) VALUES(PolygonFromText('POLYGON((
174.9128580500 -41.1331256333,
174.9131912500 -41.1330434500,
174.9134643167 -41.1332534167,
174.9136826167 -41.1332937500,
174.9128580500 -41.1331256333
))'));
So I can export my polys as simple_ascii files using the header and footer from the above example as the feature seperator then with a little fenagleing of the output file using a couple of dos batch files (which I'm happy to post) to add a comma at the end of each coordinate line and then manually editing the overall header and footer to produce a mysql ready input file. Unfortunately this fenagling process is painfully slow and requires a manual step - just to add a comma. So my question is:

Is there an easy way to output polygons in a mysql ready format?

Comments

  • mrpurple
    mrpurple Global Mapper User
    edited June 2012
    shoot too late to edit: I should also add that I also still need a way to remove the last added comma. eg by having the option to append the feature seperator directly to the end of the last coordinate and not to a new line. Its a shame that's not already the standard behaviour since adding back the new line would be as simple as starting your feature seperator with \n
  • global_mapper
    global_mapper Administrator
    edited June 2012
    While there's not currently a way to do that, one of the things that we are adding is built-in support for several different types of databases for the upcoming v14 release, so things like this should be much easier in the near future.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • Ken Frey
    Ken Frey Global Mapper User Trusted User
    edited December 2012
    Is there any way to export to a sql file instead of having to connect to a database through the program? I'd like to export in sql format and import into my database through something like phpmyadmin.
  • global_mapper
    global_mapper Administrator
    edited December 2012
    So would the export be the same as the text above, or can you import from some other format, like perhaps a CSV file with WKT coordinate strings for area and line features?

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.bluemarblegeo.com/