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

issue with converting points #30

Open
stephanietuerk opened this issue Jun 7, 2018 · 3 comments
Open

issue with converting points #30

stephanietuerk opened this issue Jun 7, 2018 · 3 comments

Comments

@stephanietuerk
Copy link

stephanietuerk commented Jun 7, 2018

I'm trying to use topojson.py to convert a geojson to topojson. The geojson was made with geopandas — originally the points were shapely point objects. My geojson looks like this:

"type": "Feature", "properties": { }, "geometry": { "type": "Point", 
"coordinates": [ 62.269649605592754, 32.429278041035452 ] } }

and I get the following error when trying to convert:

~/anaconda3/lib/python3.6/site-packages/topojson/mytypes.py in 
Point(self, point)
     35             self.polygon(coordinate);
     36     def Point(self,point):
---> 37         self.point(point['coordinates'])
     38     def Polygon(self,polygon):
     39         self.polygon(polygon['coordinates'])
TypeError: point() takes 1 positional argument but 2 were given

I'm calling topojson like so:

topojson("points.json", "pointstopo.json", quantization=1e6, simplify=0.0001) 

I can't understand what I'm doing wrong, so I'm wondering if this is a bug/if there is some sort of larger incompatibility going on.

(Also, thanks for your work developing this package!)

@hecjhs
Copy link

hecjhs commented Jul 29, 2018

Also you need to change your input data, into something like this:
{ "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 62.269649605592754, 32.429278041035452 ] } } ] }

@stephanietuerk
Copy link
Author

stephanietuerk commented Jul 30, 2018

Thanks for following up on this. I see that you opened a new issue to deal with this. Just wanted to quickly confirm that this still occurs with properly formatted jsons generated from geopandas.

Input data:

{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "geo_precision": 1, "count": 5 }, "geometry": { "type": "Point", "coordinates": [ -17.4646, 14.7574 ] } },
{ "type": "Feature", "properties": { "geo_precision": 1, "count": 5 }, "geometry": { "type": "Point", "coordinates": [ -17.4633, 14.6875 ] } },

Gets the same error.

~/anaconda3/lib/python3.6/site-packages/topojson/mytypes.py in Point(self, point)
     35             self.polygon(coordinate);
     36     def Point(self,point):
---> 37         self.point(point['coordinates'])
     38     def Polygon(self,polygon):
     39         self.polygon(polygon['coordinates'])

TypeError: point() takes 1 positional argument but 2 were given

@hecjhs
Copy link

hecjhs commented Jul 30, 2018

Using the PR #31, seem to work properly, in your data also seems that a ']' is missing, I use your data and seems to work properly here is the output:

{"type": "Topology", "bbox": [-17.4646, 14.6875, -17.4633, 14.7574], "transform": {"scale": [1.300001300001823e-09, 6.990006990007041e-08], "translate": [-17.4646, 14.6875]}, "objects": {"name": {"type": "GeometryCollection", "crs": {"type": "name", "properties": {"name": "urn:ogc:def:crs:OGC:1.3:CRS84"}}, "geometries": [{"type": "Point", "coordinates": [0, 999999], "properties": {"geo_precision": 1, "count": 5}}, {"type": "Point", "coordinates": [999999, 0], "properties": {"geo_precision": 1, "count": 5}}]}}, "arcs": []}

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

No branches or pull requests

2 participants