#21153 closed Uncategorized (worksforme)

DataSource doesn't seem to work with 'OSM' type

Reported by: philipn Owned by: nobody
Component: GIS Version: 1.5
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

>>> from django.contrib.gis.gdal import DataSource
>>> ds = DataSource('/vagrant/davis.osm')
>>> for layer in ds:
...    print layer
... 
points
lines
multilinestrings
multipolygons
other_relations
>>> for layer in ds:
...    print layer.get_geoms()
... 
[]
[]
[]
[]
[]

and with ogrinfo:

(env)vagrant@precise32:/vagrant$ ogrinfo davis.osm multipolygons
Had to open data source read-only.
INFO: Open of `davis.osm'
      using driver `OSM' successful.

Layer name: multipolygons
Geometry: Multi Polygon
Feature Count: -1
Layer SRS WKT:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        TOWGS84[0,0,0,0,0,0,0],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9108"]],
    AUTHORITY["EPSG","4326"]]
osm_id: String (0.0)
osm_way_id: String (0.0)
name: String (0.0)
type: String (0.0)
aeroway: String (0.0)
amenity: String (0.0)
admin_level: String (0.0)
barrier: String (0.0)
boundary: String (0.0)
building: String (0.0)
craft: String (0.0)
geological: String (0.0)
historic: String (0.0)
land_area: String (0.0)
landuse: String (0.0)
leisure: String (0.0)
man_made: String (0.0)
military: String (0.0)
natural: String (0.0)
office: String (0.0)
place: String (0.0)
shop: String (0.0)
sport: String (0.0)
tourism: String (0.0)
other_tags: String (0.0)
OGRFeature(multipolygons):32323842
  osm_id (String) = (null)
  osm_way_id (String) = 32323842
  name (String) = Davis
  type (String) = (null)
  aeroway (String) = (null)
  amenity (String) = (null)
  admin_level (String) = 8
  barrier (String) = (null)
  boundary (String) = administrative
  building (String) = (null)
  craft (String) = (null)
  geological (String) = (null)
  historic (String) = (null)
  land_area (String) = (null)
  landuse (String) = (null)
  leisure (String) = (null)
  man_made (String) = (null)
  military (String) = (null)
  natural (String) = (null)
  office (String) = (null)
  place (String) = (null)
  shop (String) = (null)
  sport (String) = (null)
  tourism (String) = (null)
  other_tags (String) = border_type=>city,is_in=>"USA, California",is_in:country=>USA,is_in:country_code=>US,is_in:iso_3166_2=>US:CA,is_in:state=>California,is_in:state_code=>CA,place_name=>Davis,tiger:CLASSFP=>C1,tiger:CPI=>Y,tiger:FUNCSTAT=>A,tiger:LSAD=>25,tiger:MTFCC=>G4110,tiger:NAME=>Davis,tiger:NAMELSAD=>"Davis city",tiger:PCICBSA=>N,tiger:PCINECTA=>N,tiger:PLACEFP=>18100,tiger:PLACENS=>02410296,tiger:PLCIDFP=>0618100,tiger:reviewed=>no,tiger:STATEFP=>06,wikipedia=>"Davis,_California"
  MULTIPOLYGON (((-121.7939205 38.5614314,-121.7727461 38.561163,-121.7725486 38.5682768,-121.767313 38.5682298,-121.7672872 38.5715851,-121.7656221 38.5714979,-121.7655534 38.5720347,-121.7583866 38.5718871,-121.758275 38.5755912,-121.7477436 38.57541,-121.7457266 38.56876,-121.7400274 38.5687063,-121.7374525 38.5609415,-121.737298 38.5607804,-121.7367658 38.5608006,-121.7362251 38.5608945,-121.735238 38.5612972,-121.7327919 38.5622905,-121.7319765 38.5625053,-121.7313585 38.5626126,-121.7308349 38.5747524,-121.7126388 38.574786,-121.7128276 38.564069,-121.698863 38.5652904,-121.6991377 38.5604583,-121.6938333 38.5603912,-121.6940822 38.5538605,-121.6754999 38.5580354,-121.6757059 38.548155,-121.6942281 38.5483564,-121.6945028 38.5385418,-121.7025366 38.5385888,-121.7025537 38.5433082,-121.7029657 38.5433418,-121.7068281 38.5426168,-121.7110338 38.5411264,-121.7132997 38.5411802,-121.7133512 38.5376488,-121.7183981 38.5357757,-121.7197885 38.5351513,-121.7223806 38.5348626,-121.724123 38.5355542,-121.7258396 38.5359771,-121.7278137 38.5362457,-121.7285003 38.5363598,-121.7287906 38.5386757,-121.7311938 38.5387985,-121.7310152 38.5358898,-121.7327661 38.5361383,-121.7338648 38.5373467,-121.7366972 38.5384209,-121.7380705 38.5372662,-121.7394867 38.5376153,-121.7399158 38.5381524,-121.7400016 38.5393742,-121.7416582 38.5398845,-121.7437353 38.5402671,-121.7441387 38.5412271,-121.7467394 38.5407841,-121.7472715 38.5420797,-121.7468853 38.5421804,-121.7480011 38.5462083,-121.7940664 38.546705,-121.7939205 38.5614314)))

Which hopefully shows I have all the right libraries installed. I've attached the 'davis.osm' file for reference.

This is on Django 1.5.4 with PostGIS 2 + gdal 1.10.0

Attachments (1)

davis.osm (13.3 KB) - added by philipn 18 months ago.

Download all attachments as: .zip

Change History (3)

Changed 18 months ago by philipn

comment:1 Changed 18 months ago by claudep

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

I cannot reproduce this issue with Django 1.5 and gdal 1.9.0. I suspect this is either an issue on your system or a compatibility problem with gdal 1.10 (which I cannot test myself currently).

comment:2 Changed 18 months ago by timo

  • Resolution set to worksforme
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.
Back to Top