New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support the_geom column within CSV plugin #2876

Closed
tmcw opened this Issue May 27, 2015 · 2 comments

Comments

Projects
None yet
4 participants
@tmcw
Contributor

tmcw commented May 27, 2015

Given this CSV file https://cloudup.com/cybGeFiyh0v from this blog post https://medium.com/@debsarctica/data-sharing-lyft-hotspots-f913ae16c233 PostGIS-exported (I would assume) spreadsheets store latitude, longitude pairs in CSV files, and Mapnik doesn't recognize this value. Would it be possible to support this format?

@BergWerkGIS

This comment has been minimized.

Show comment
Hide comment
@BergWerkGIS

BergWerkGIS May 31, 2015

Member

the_geom per se, is supported (lower_val.find("geom")), but not yet this special format.

Lat and lng as string in one column:
[the_geom] : "-122.4480, 37.7664"

Member

BergWerkGIS commented May 31, 2015

the_geom per se, is supported (lower_val.find("geom")), but not yet this special format.

Lat and lng as string in one column:
[the_geom] : "-122.4480, 37.7664"

@artemp

This comment has been minimized.

Show comment
Hide comment
@artemp

artemp Jun 1, 2015

Member

Currently if header is "wkt" or contains "geom" it is processed as WKT. To add support for "lon, lat" we need to read first line of data from CSV, extract geometry field and check for supported formats. Simple regex match should do the trick for lon,lat

std::regex lon_lat_regex("^(\\-?\\d+(\\.\\d+)?),\\s*(\\-?\\d+(\\.\\d+)?)$");
if (std::regex_match( geom_val , lon_lat_regex))
{
 // this is lon/lat
}
else
{
// default to WKT ?
}

/cc @springmeyer - should we push this one into 3.x.x? It'll require finally re-factoring CSV plug-in a bit.

Member

artemp commented Jun 1, 2015

Currently if header is "wkt" or contains "geom" it is processed as WKT. To add support for "lon, lat" we need to read first line of data from CSV, extract geometry field and check for supported formats. Simple regex match should do the trick for lon,lat

std::regex lon_lat_regex("^(\\-?\\d+(\\.\\d+)?),\\s*(\\-?\\d+(\\.\\d+)?)$");
if (std::regex_match( geom_val , lon_lat_regex))
{
 // this is lon/lat
}
else
{
// default to WKT ?
}

/cc @springmeyer - should we push this one into 3.x.x? It'll require finally re-factoring CSV plug-in a bit.

@springmeyer springmeyer added this to the Mapnik 3.1.0 milestone Jul 9, 2015

@tmcw tmcw closed this Apr 11, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment