1

I've done a blank Django project. Then shared it via git on gitlab. Then downloaded a very small region from geofabrik Then:

  • in Windows I've imported it via: osm2pgsql -c -U xx -d yy -H localhost -W -E4326~/myfile.osm.pbf

  • in Linux I had to change 4326 to 3857 to make it work, otherwise coordinates in the admin interface didn't show up properly.

From there I've made my models:

Here's are my models (all the same fields for Line, Polygon, Point and Roads, just one is enough):

class PlanetOsmLine(models.Model):
    class Meta:
        db_table = 'planet_osm_line'
        managed = False

    osm_id = models.BigIntegerField(primary_key=True)
    # ...tons of other field (unused)...
    way = GeometryField(default=None)

Now, for the same osm_id, this requests works under Windows, and gives me many results but under Linux I have an empty array (!!):

source = PlanetOsmPolygon.objects.get(osm_id="717295797").way
print([a.osm_id for a in PlanetOsmPolygon.objects.filter(
    way__contains=source
)])

What am I doing wrong, what are the tests I should do to make it work/look for the problem? I dont know where to start.

1

Answer:

osm2pgsql 0.88.1 doesn't import properly when setting option "-E 4326"

-> manual compiling latest version under Mint gave me: osm2pgsql 0.96.0 (64 bit id space)

And the import went fine and all queries now work. So be careful: the official package might not work, try to manual compile (very easy (if I could do it, anybody can do it ;^))).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.