Created
November 29, 2012 00:58
-
-
Save springmeyer/4165970 to your computer and use it in GitHub Desktop.
mapnik natural earth field parsing bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mapnik | |
# wget http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_populated_places.zip | |
ds = mapnik.Shapefile(file='ne_10m_populated_places.shp',row_limit=1) | |
# fixes the shape: | |
# ogr2ogr ne_10m_populated_places_fixed.shp ne_10m_populated_places.shp | |
#ds = mapnik.Shapefile(file='ne_10m_populated_places_fixed.shp',row_limit=1) | |
feats = ds.all_features() | |
print feats[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run against https://github.com/nvkelso/natural-earth-vector/raw/master/archive/ne_10m_populated_places_1.4.0.zip | |
Feature ( id=1 | |
ADM0CAP:0.0 | |
ADM0NAME:Uruguay | |
ADM0_A3:URY | |
ADM1NAME:Colonia | |
ADMIN1_COD:4.0 | |
CAPALT:0.0 | |
CAPIN: | |
CHANGED:0.0 | |
CHECKME:0 | |
CITYALT: | |
COMPARE:0 | |
DIFFASCII:0 | |
DIFFNOTE: | |
ELEVATION:0.0 | |
FEATURECLA:Populated place | |
FEATURE_CL:P | |
FEATURE_CO:PPL | |
GEONAMEID:3443341.0 | |
GEONAMESNO:Geonames ascii name + lat.d + long.d matching. | |
GN_ASCII:Carmelo | |
GN_POP:16921 | |
GTOPO30:19.0 | |
ISO_A2:UY | |
LABELRANK:8 | |
LATITUDE:-33.9896191214999988 | |
LONGITUDE:-58.2999921078000014 | |
LS_MATCH:1 | |
LS_NAME:Carmelo | |
MAX_AREAKM:8.0 | |
MAX_AREAMI:3.0 | |
MAX_BBXMAX:-58.2666666699999994 | |
MAX_BBXMIN:-58.2999999999999972 | |
MAX_BBYMAX:-33.9750000000000014 | |
MAX_BBYMIN:-34.0083333299999993 | |
MAX_NATSCA:20 | |
MAX_PERKM:14.0 | |
MAX_PERMI:8.0 | |
MAX_POP10:13306 | |
MAX_POP20:13306 | |
MAX_POP300:0 | |
MAX_POP310:0 | |
MAX_POP50:0 | |
MEAN_BBXC:-58.2852272700000001 | |
MEAN_BBYC:-33.9943181800000004 | |
MEGACITY:0 | |
MEGANAME: | |
MIN_AREAKM:8 | |
MIN_AREAMI:3.0 | |
MIN_BBXMAX:-58.2666666699999994 | |
MIN_BBXMIN:-58.2999999999999972 | |
MIN_BBYMAX:-33.9750000000000014 | |
MIN_BBYMIN:-34.0083333299999993 | |
MIN_PERKM:14.0 | |
MIN_PERMI:8.0 | |
NAME:Carmelo | |
NAMEALT: | |
NAMEASCII:Carmelo | |
NAMEDIFF:0 | |
NAMEPAR: | |
NATSCALE:20 | |
NOTE: | |
POP1950:0.0 | |
POP1955:0.0 | |
POP1960:0.0 | |
POP1965:0.0 | |
POP1970:0.0 | |
POP1975:0.0 | |
POP1980:0.0 | |
POP1985:0.0 | |
POP1990:0.0 | |
POP1995:0.0 | |
POP2000:0.0 | |
POP2005:0.0 | |
POP2010:0.0 | |
POP2015:0.0 | |
POP2020:0.0 | |
POP2025:0.0 | |
POP2050:0.0 | |
POP_MAX:16921 | |
POP_MIN:13306 | |
POP_OTHER:13306 | |
SCALERANK:7 | |
SOV0NAME:Uruguay | |
SOV_A3:URY | |
TIMEZONE:America/Montevideo | |
UN_ADM0: | |
UN_FID:0 | |
UN_LAT:0.0 | |
UN_LONG:0.0 | |
WORLDCITY:0.0 | |
ls_gross:0 | |
popDiff:1 | |
popPerc:0.78636 | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature ( id=1 | |
ADM0CAP: | |
ADM0NAME:Uruguay | |
ADM0_A3:URY | |
ADM1NAME:Colonia | |
ADMIN1_COD: | |
CAPALT: | |
CAPIN: | |
CHANGED: | |
CHECKME: | |
CITYALT: | |
COMPARE: | |
DIFFASCII: | |
DIFFNOTE:Added missing admin-1 capital. Population from GeoNames. | |
ELEVATION: | |
FEATURECLA:Admin-1 capital | |
FEATURE_CL:P | |
FEATURE_CO:PPL | |
GEONAMEID:3443013.0 | |
GEONAMESNO:Geonames ascii name + lat.d + long.d matching. | |
GN_ASCII:Colonia del Sacramento | |
GN_POP: | |
GTOPO30: | |
ISO_A2:UY | |
LABELRANK: | |
LATITUDE: | |
LONGITUDE: | |
LS_MATCH: | |
LS_NAME: | |
MAX_AREAKM: | |
MAX_AREAMI: | |
MAX_BBXMAX: | |
MAX_BBXMIN: | |
MAX_BBYMAX: | |
MAX_BBYMIN: | |
MAX_NATSCA: | |
MAX_PERKM: | |
MAX_PERMI: | |
MAX_POP10: | |
MAX_POP20: | |
MAX_POP300: | |
MAX_POP310: | |
MAX_POP50: | |
MEAN_BBXC: | |
MEAN_BBYC: | |
MEGACITY: | |
MEGANAME: | |
MIN_AREAKM: | |
MIN_AREAMI: | |
MIN_BBXMAX: | |
MIN_BBXMIN: | |
MIN_BBYMAX: | |
MIN_BBYMIN: | |
MIN_PERKM: | |
MIN_PERMI: | |
NAME:Colonia del Sacramento | |
NAMEALT: | |
NAMEASCII:Colonia del Sacramento | |
NAMEDIFF: | |
NAMEPAR: | |
NATSCALE: | |
NOTE: | |
POP1950: | |
POP1955: | |
POP1960: | |
POP1965: | |
POP1970: | |
POP1975: | |
POP1980: | |
POP1985: | |
POP1990: | |
POP1995: | |
POP2000: | |
POP2005: | |
POP2010: | |
POP2015: | |
POP2020: | |
POP2025: | |
POP2050: | |
POP_MAX: | |
POP_MIN: | |
POP_OTHER: | |
RANK_MAX: | |
RANK_MIN: | |
SCALERANK: | |
SOV0NAME:Uruguay | |
SOV_A3:URY | |
TIMEZONE:America/Montevideo | |
UN_ADM0: | |
UN_FID: | |
UN_LAT: | |
UN_LONG: | |
WORLDCITY: | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
expected result is: