omniscale / imposm3

Imposm imports OpenStreetMap data into PostGIS
http://imposm.org/docs/imposm3/latest/
Apache License 2.0
710 stars 156 forks source link

Importing current planet file can result in a geometry with a nan coordinate #199

Closed JesseCrocker closed 5 years ago

JesseCrocker commented 5 years ago

Context

Importing a node placed at the south pole in the current planet file results in a geometry with a nan coordinate.

The problem node is https://www.openstreetmap.org/node/436012592 which is located at -90,0

Expected Behavior

Node is either not imported, or has coordinate set to the maximum valid value.

Actual Behavior

Geometry has a nan coordinate

Steps to Reproduce

mapping.yaml

name_field: &name
  name: name
  key: name
  type: string
name_en_field: &name_en
  name: name_en
  key: name:en
  type: string
rank_field: &rank
  name: rank
  key: rank
  type: integer

tables:
  city_point:
    type: point
    fields:
      - name: osm_id
        type: id
      - name: geometry
        type: geometry
      - *name
      - *name_en
      - name: tags
        type: hstore_tags
      - name: place
        key: place
        type: string
      - key: population
        name: population
        type: integer
      - key: capital
        name: capital
        type: string
      - *rank
    filters:
      require:
        name: ["__any__"]
    mapping:
      place:
        - city
        - town
        - village
        - hamlet
        - suburb
        - neighbourhood
        - isolated_dwelling
        - locality

Imposm invoked as import -mapping generated/mapping.yaml -srid 3857 -read data/data.osm.pbf -write -connection postgis://$(DBUSER)@$(DBHOST)/$(DBNAME) -overwritecache -optimize -deployproduction

osm=# select st_asText(geometry), geometry, osm_id from osm_city_point where not st_isvalid(geometry);
NOTICE:  Invalid Coordinate at or near point -0.0046093609272060835 nan
           st_astext           |                      geometry                      |  osm_id
-------------------------------+----------------------------------------------------+-----------
 POINT(-0.004609360927206 nan) | 0101000020110F0000714501E743E172BF010000000000F87F | 436012592
(1 row)

Your Environment

Postgis 11, from mdillon/postgis:11-alpine docker image

Using imposm 0.7.2, downloaded from https://github.com/omniscale/imposm3/releases/download/v0.7.2/imposm-0.7.2-linux-x86-64.tar.gz

Using May 27 planet file from https://s3.amazonaws.com/osm-pds/2019/planet-190527.osm.pbf

ImreSamu commented 5 years ago

imho: this is similar to -> https://github.com/omniscale/imposm3/issues/106 ( South Pole, nan, invalid coordinate, 3857 )

JesseCrocker commented 5 years ago

Whoops, didn't see that. Closing as duplicate.