Giter Club home page Giter Club logo

geojson-regions's Introduction

GeoJSON Regions

A repo to create simplified GeoJSON regions so we can display map-based visualisations without having to load tiles all over the place.

These are compiled from on the Natural Earth data which offers public domain shapefiles.

The data

Data is organised by resolution (10m, 50m & 110m), and each country is stored under a ISO 3166-1 alpha-3 country code.

This stuff is fairly subjective. Natural earth states:

Natural Earth Vector draws boundaries of sovereign states according to defacto status. We show who actually controls the situation on the ground. For instance, we show China and Taiwan as two separate states. But we show Palestine as part of Israel. Please feel free to mashup our countries and disputed areas themes to match your particular political outlook.

Fetching the latest data

I'm aiming to keep this one up to date, but if you need to fetch the latest data you can do so by running go.sh in the repo root.

If you notice the repo is out of date, please feel free to make a pull request.

Note: you require gdal installed on your system (ogr2ogr command converts shapefiles to geojson).

Testing

Really loose unit tests are in the test/ folder. These ensure the data hasn't deviated too much from sensibility between updates.

npm install
npm test

Contributing

The only data changes I'll accept in this repo are those fetched from naturalearthdata.com. Please don't make a pull request with modified data.

If you can improve the build tools, or have a new transformation you want to add go for it!

geojson-regions's People

Contributors

ashkyd avatar mbrohl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

geojson-regions's Issues

Israel is missing

When I choose to download geojson with the Asia region, or just click on israel and download that data, Israel doesn't exist in the data.

French Guiana with a separate border

Hi, I'm using your library for one of my project and it's really helpfull. At the moment I'm working for COCOM map. So each of COCOM area should have a separate color. Everything is ok but I have small issue with French Guiana to make SOUTHCOM Area in one color. How I can to edit json for French borders to make French Guiana as a separate area? Thanks :)

Possibility of adding US states?

Is it possible to have the individual states be a part of the map data for the United States? I have a very specific application that I am working on that needs to have all the world countries, but for the US I also need to have the individual states as selectable regions.

Thanks!

Crimea shown as part of Russia

Showing Crimea as part of Russia is a standard error on maps, and most probably need to be made aware of the political stance this implies.
I propose to correct this and show Crimea as belonging to Ukraine.

Denmark missing

It looks like you are pointing Denmark to DN1 which is Greenland.

Invalid geometries

I need to be able to compute a "center" point for the largest landmasses in the geometries for the countries. The shapely.ops.polylabel function implements a good algorithm for doing that.

Note that if I use the 50m (https://github.com/AshKyd/geojson-regions/blob/master/countries/50m/SDN.geojson) version of the file, polylabel works.

Unfortunately, the geometry defined by SDN.geojson is invalid. Shapely's explain_validity function returns the following information:

0    Self-intersection[33.9633927949711 9.464285229...
Name: geometry, dtype: object

make_valid generates the following error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Input In [5], in <cell line: 355>()
    353 gdf = geopandas.GeoDataFrame.from_features( features, crs = 4326 )   
    354 print( explain_validity( gdf.geometry ) )
--> 355 print( make_valid( gdf.geometry ) )
    356 gdf.plot( figsize = ( 20, 20 ) )
    357 center = polylabel( gdf.geometry.values[0], tolerance = .1 ) 

File shapely/validation.py:53, in make_valid(ob)
     29 def make_valid(ob):
     30     """
     31     Make the input geometry valid according to the GEOS MakeValid algorithm.
     32 
   (...)
     51 
     52     """
---> 53     if ob.is_valid:
     54         return ob
     55     return shapely.make_valid(ob)

File pandas/core/generic.py:1527, in NDFrame.__nonzero__(self)
   1525 @final
   1526 def __nonzero__(self) -> NoReturn:
-> 1527     raise ValueError(
   1528         f"The truth value of a {type(self).__name__} is ambiguous. "
   1529         "Use a.empty, a.bool(), a.item(), a.any() or a.all()."
   1530     )

ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

I suggest updating how the geometries are computed so they are guaranteed to be valid. There are several other invalid geometries in the dataset.

A script that generates the error is:

The data is the SDN.geojson file located at https://github.com/AshKyd/geojson-regions/blob/master/countries/110m/SDN.geojson
(removed some of the "properties" for simplicity). It will draw correctly.

import json
from shapely.ops import polylabel
import geopandas
import os

data = {
  "type": "Feature",
  "properties": {
    "featurecla": "Admin-0 country",
    "filename": "SDN.geojson"
  },
  "geometry": {
    "type": "Polygon",
    "coordinates": [
      [
        [
          24.567369012152085,
          8.229187933785468
        ],
        [
          23.805813429466752,
          8.666318874542526
        ],
        [
          23.459012892355986,
          8.954285793488893
        ],
        [
          23.394779087017184,
          9.265067857292223
        ],
        [
          23.55724979014283,
          9.681218166538684
        ],
        [
          23.554304233502194,
          10.089255275915308
        ],
        [
          22.97754357269261,
          10.71446259199854
        ],
        [
          22.864165480244225,
          11.142395127807546
        ],
        [
          22.87622,
          11.384610000000123
        ],
        [
          22.50869,
          11.67936
        ],
        [
          22.49762,
          12.26024
        ],
        [
          22.28801,
          12.64605
        ],
        [
          21.93681,
          12.588180000000136
        ],
        [
          22.03759,
          12.95546
        ],
        [
          22.29658,
          13.37232
        ],
        [
          22.18329,
          13.78648
        ],
        [
          22.51202,
          14.09318
        ],
        [
          22.30351,
          14.32682
        ],
        [
          22.56795000000011,
          14.944290000000137
        ],
        [
          23.024590000000103,
          15.68072
        ],
        [
          23.886890000000108,
          15.61084
        ],
        [
          23.83766000000014,
          19.580470000000105
        ],
        [
          23.850000000000136,
          20
        ],
        [
          25.000000000000114,
          20.00304
        ],
        [
          25,
          22
        ],
        [
          29.02,
          22
        ],
        [
          32.9,
          22
        ],
        [
          36.86623,
          22
        ],
        [
          37.1887200000001,
          21.01885
        ],
        [
          36.96941,
          20.83744000000013
        ],
        [
          37.11470000000014,
          19.80796
        ],
        [
          37.4817900000001,
          18.61409
        ],
        [
          37.86276,
          18.36786
        ],
        [
          38.410089959473225,
          17.998307399970315
        ],
        [
          37.90400000000011,
          17.42754
        ],
        [
          37.16747,
          17.263140000000135
        ],
        [
          36.852530000000115,
          16.95655
        ],
        [
          36.75389,
          16.29186
        ],
        [
          36.32322,
          14.82249
        ],
        [
          36.42951,
          14.42211
        ],
        [
          36.27022,
          13.563330000000121
        ],
        [
          35.86363,
          12.57828
        ],
        [
          35.26049,
          12.08286
        ],
        [
          34.83163000000013,
          11.318960000000118
        ],
        [
          34.73115000000013,
          10.910170000000107
        ],
        [
          34.25745,
          10.63009
        ],
        [
          33.96162,
          9.58358
        ],
        [
          33.97498,
          8.68456
        ],
        [
          33.963392794971185,
          9.464285229420625
        ],
        [
          33.82496348090751,
          9.484060845715362
        ],
        [
          33.84213085302815,
          9.981914637215993
        ],
        [
          33.72195924818311,
          10.325262079630193
        ],
        [
          33.206938084561784,
          10.720111638406593
        ],
        [
          33.086766479716744,
          11.441141267476496
        ],
        [
          33.206938084561784,
          12.179338268667095
        ],
        [
          32.743419037302544,
          12.248007757149992
        ],
        [
          32.67474954881965,
          12.02483191958072
        ],
        [
          32.073891524594785,
          11.973329803218519
        ],
        [
          32.31423473428475,
          11.68148447716652
        ],
        [
          32.400071594888345,
          11.080626452941488
        ],
        [
          31.850715687025513,
          10.531270545078826
        ],
        [
          31.35286189552488,
          9.810240916008695
        ],
        [
          30.837840731903384,
          9.70723668328452
        ],
        [
          29.996639497988554,
          10.290927335388687
        ],
        [
          29.61895731133285,
          10.084918869940225
        ],
        [
          29.515953078608618,
          9.793073543888056
        ],
        [
          29.000931914987177,
          9.60423245056029
        ],
        [
          28.966597170745786,
          9.398223985111656
        ],
        [
          27.970889587744352,
          9.398223985111656
        ],
        [
          27.833550610778786,
          9.60423245056029
        ],
        [
          27.112520981708883,
          9.638567194801624
        ],
        [
          26.752006167173818,
          9.466893473594496
        ],
        [
          26.477328213242515,
          9.552730334198088
        ],
        [
          25.962307049621018,
          10.136420986302426
        ],
        [
          25.790633328413946,
          10.411098940233728
        ],
        [
          25.069603699343986,
          10.273759963267992
        ],
        [
          24.794925745412684,
          9.810240916008695
        ],
        [
          24.53741516360202,
          8.91753756573172
        ],
        [
          24.19406772118765,
          8.728696472403897
        ],
        [
          23.886979580860668,
          8.619729712933065
        ],
        [
          24.567369012152085,
          8.229187933785468
        ]
      ]
    ]
  }
}

features = {
    "type": "FeatureCollection",
    "features": [data]
}

gdf = geopandas.GeoDataFrame.from_features( features, crs = 4326 )   
print( explain_validity( gdf.geometry ) )
gdf.plot( figsize = ( 20, 20 ) )
center = polylabel( gdf.geometry.values[0], tolerance = .1 ) 
print( center )

Crimean Peninsula is Ukrainian territory

Crimean Peninsula is shown as Russian, which is not true, this is the territory of Ukraine. I don't think you support Russian aggression and terrorism, don't you?

Error: ENOENT: no such file or directory, open 'all.geojson'

When running ./go.sh, it throws following error:

Error: ENOENT: no such file or directory, open 'all.geojson'
    at Object.openSync (fs.js:443:3)
    at Object.readFileSync (fs.js:348:35)

I found that in go.sh file, the rm command deletes the file. I think all.geojson should be kept somewhere else as it is a reference to generate rest of the files.

Continent data

Not so much an issue as it is a question. How do I get data at the continent level? I need a map with just the 6 major continents labeled.

The US is missing

When I chose High resolution (10 metre, largest file) and selected all regions, the US is missing.

Problem with loading the geojson information for some of the countries

Hi
Thanks for your time and contribution to this amazing library.
Today, I downloaded the latest geojson file for Europe using the the tool on "https://geojson-maps.ash.ms/" and I noticed that the geojson regions for the following countries are not loaded in my application: Denmark,United Kingdom,France, Netherlands
I took a look at the "geojson-regions/countries/10m/index.json" file and searched for the Denmark entry which seems to be referring to the "DN1.geojson" file which actually represents Greenland.
Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.