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

Improper scoping in projections? #39

Closed
lmommaerts opened this issue Jun 20, 2016 · 4 comments
Closed

Improper scoping in projections? #39

lmommaerts opened this issue Jun 20, 2016 · 4 comments
Assignees

Comments

@lmommaerts
Copy link

I'm trying to use the geoAlbersUsa projection, but this code returns an error.

Code:

import { geoAlbersUsa } from 'd3-geo';

const projection = geoAlbersUsa()
const coords = projection([37, -96]) || [];

Error:
d3-geo.js:2216 Uncaught TypeError: Cannot read property 'stream' of undefined

which is pointing to this line: https://github.com/d3/d3-geo/blob/master/src/projection/index.js#L13
and this file: https://github.com/d3/d3-geo/blob/a36f5cac465003ba8b6ceeee3834b1cef2b3a5f5/src/transform.js

I believe (though I could very well be using this incorrectly) that there's an issue with the function scoping, leading this to be undefined.

@mbostock
Copy link
Member

This is a bug. I will fix it.

@mbostock mbostock self-assigned this Jun 20, 2016
@mbostock
Copy link
Member

Although assuming you are trying to project a point along the Kansas-Oklahoma border, you’ll want to say [-96, 37] because the order is [longitude, latitude].

@mbostock
Copy link
Member

Fixed in 0.0.4.

@lmommaerts
Copy link
Author

Great, thanks!

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

No branches or pull requests

2 participants