Open pbugnion opened 7 years ago
can you please tell how to install new version with geojson? pip says that 0.4.0 is last version tried to install by cloning and "setup.py install", but got a lot of problems like installing dev versions of ipywidgets etc. I use python 3 if it matters. thanks
There is a pre-release version on Pypi.
$ pip install gmaps==0.4.1-pre1 $ jupyter nbextension enable --py --sys-prefix widgetsnbextension
Edit: this is now moot. You should use the stable version 0.4.1
.
$ pip install gmaps==0.4.1
$ jupyter nbextension enable --py --sys-prefix widgetsnbextension
Thanks, it works, but there's no method named 'geojson_geometries' like it's in readme...only 'geojson_layer'
It's a module -- you need to import it with import gmaps.geojson_geometries
.
Oh, thanks, didn't notice. And please, last question: how to import geometry from custom json file? In your example only standart geometries.
Have a look at the loading your own GeoJSON section in the documentation.
gmaps.geojson_geometries did not load on v0.4.0 I installed V0.4.1 and the module did import so thanks for this tip. Issue now is gmaps.geojson_layer....showing as not callable
`
import gmaps
import gmaps.geojson_geometries
import gmaps.geojson_layer
gmaps.configure(api_key="MY_KEY")
countries_geojson = gmaps.geojson_geometries.load_geometry('countries')
m = gmaps.Map()
gini_layer = gmaps.geojson_layer(countries_geojson)
m.add_layer(gini_layer)
m
`
`TypeError Traceback (most recent call last)
Thanks for the feedback!
gmaps.geojson_geometries did not load on v0.4.0. I installed V0.4.1 and the module did import[...]
GeoJSON support was added in v0.4.1, so anything before that wouldn't work.
Issue now is gmaps.geojson_layer....showing as not callable
In Python, you cannot import functions directly like this. You should do this:
import gmaps
import gmaps.geojson_geometries
countries_geojson = gmaps.geojson_geometries.load_geometry('countries')
m = gmaps.Map()
gini_layer = gmaps.geojson_layer(countries_geojson)
m.add_layer(gini_layer)
m
The reason your import didn't fail was because it clashed with an internal module name, which, in hindsight, adds a bit of confusion.
Thank you for clearing up the confusion. That solved the issue.
Gmaps bundles useful GeoJSON geometries to save users the work of having to find them from the Internet. There are currently a handful of geometries included. Adding new geometries is a very useful way to contribute to
gmaps
. If you use gmaps with your own GeoJSON file, chances are that other people would also find it useful. Contributing the file back to gmaps is a meaningful way to contribute to the project.What makes a good GeoJSON file
GeoJSON files should be between 1MB and 3MB. If your file is larger than that, you can use mapshaper to simplify it.
The license needs to match that of GMaps: the file should either be in the public domain, or it should be MIT or Apache licensed.
How to contribute GeoJSON files
If you have a way to share your file on the Internet (either by putting it on Amazon S3, or through a Dropbox link, or by putting it on a web server), then do this and add the link to the geojson_geometries) module. We will probably copy the file onto the Amazon S3 bucket stored with gmaps and change the link that you submitted.
If you do not have a way to share the file, open an issue in GitHub and upload your file through that.