Skip to content
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

Added optional coordinateConversion method #5

Closed
wants to merge 2 commits into from

Conversation

tadiraman
Copy link

Example usage (for GlobalMercator, see https://gist.github.com/tadiraman/12f850ad5a6bdcdc59fb):

var mercator = new GlobalMercator();
var converter = geojson2svg(viewportSize,
   {coordinateConversion: mercator.LatLonToMeters});

This can be used to generate SVG with correct projection to match web maps.

@gagan-bansal
Copy link
Owner

Yes reprojecting geojson to Web Mercator or other desired projection is very fundamental requirement. In my example's javascript code I reproject geojson from WGS 84 to Web Mercator projection using reproject. i.e. based on proj4js projection library.

 // covert wgs84 data to Web Mercator projection
var geojson = reproject.reproject(
geojson,'EPSG:4326','EPSG:3857',proj4.defs);

My idea is to keep the geojson2svg as modular as possible, do not want to make it as library. May be collection of such tools (GlobalMercator, reproject etc) combined together with geojson2svg can make a library.
That is why I didn't include reprojection in geojson2svg module.

Please feel free to discuss further and thanks for taking interest in geojson2svg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants