├── .github └── workflows │ ├── test_py2.yml │ └── test_py3.yml ├── .gitignore ├── .gitmodules ├── Contributing.md ├── LICENSE ├── README.md ├── geom.py ├── ogr2osm.py ├── setup.py └── testfiles ├── basic.t ├── basic_py2.t ├── duplicate-way-nodes.xml ├── duplicate-way-nodes_py2.xml ├── japanese_py2.xml ├── positiveid.xml ├── positiveid_py2.xml ├── shapefiles ├── duplicate-way-nodes.gml ├── japanese.dbf ├── japanese.shp ├── japanese.shx ├── sp_usinas.dbf ├── sp_usinas.prj ├── sp_usinas.shp ├── sp_usinas.shx ├── test1.dbf ├── test1.prj ├── test1.shp └── test1.shx ├── test1.xml ├── test1_py2.xml ├── utf8.xml ├── utf8_py2.xml ├── version.xml └── version_py2.xml /.github/workflows/test_py2.yml: -------------------------------------------------------------------------------- 1 | name: test-py2 2 | 3 | on: [push] 4 | 5 | jobs: 6 | testpy2: 7 | runs-on: ubuntu-18.04 8 | 9 | steps: 10 | - uses: actions/checkout@v2 11 | # Use the python version installed by Ubuntu 18.04 (version 2.7.15), 12 | # so we can use precompiled gdal and protobuf 13 | - name: Install xmllint and GDAL 14 | run: sudo apt-get install -y libxml2-utils gdal-bin libgdal-dev python-gdal 15 | - name: "Install python dependencies: cram and lxml" 16 | run: | 17 | python -m pip install --upgrade pip 18 | pip install cram lxml 19 | - name: Testing the code with cram 20 | run: | 21 | cram testfiles/basic_py2.t 22 | 23 | -------------------------------------------------------------------------------- /.github/workflows/test_py3.yml: -------------------------------------------------------------------------------- 1 | name: test-py3 2 | 3 | on: [push] 4 | 5 | jobs: 6 | testpy3: 7 | runs-on: ubuntu-20.04 8 | 9 | steps: 10 | - uses: actions/checkout@v2 11 | # Use the python version installed by Ubuntu 20.04 (version 3.8.5), 12 | # so we can use precompiled gdal and protobuf 13 | - name: Install xmllint and GDAL 14 | run: sudo apt-get install -y libxml2-utils gdal-bin libgdal-dev python3-gdal 15 | - name: "Install python dependencies: cram and lxml" 16 | run: | 17 | python -m pip install --upgrade pip 18 | pip install cram lxml 19 | - name: Testing the code with cram 20 | run: | 21 | cram testfiles/basic.t 22 | 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.osm 3 | *.shp 4 | *.shx 5 | *.prj 6 | *.dbf 7 | *.SHP 8 | *.SHX 9 | *.PRJ 10 | *.DBF 11 | .DS_Store 12 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "translations"] 2 | path = translations 3 | url = git://github.com/pnorman/ogr2osm-translations.git 4 | -------------------------------------------------------------------------------- /Contributing.md: -------------------------------------------------------------------------------- 1 | ## Tests 2 | Test your code and make sure it passes. cram is used for tests. 3 | 4 | Changes in speed-critical parts of the code may require profiling. 5 | 6 | ## Licensing 7 | 8 | ogr2osm is under the MIT license. If you are committing to ogr2osm, 9 | you are committing under this license. If you do not wish to do so, 10 | do not submit pull requests. 11 | 12 | If you wish to be added to the copyright holders list, submit a pull 13 | request. 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2013 Paul Norman , Sebastiaan Couwenberg 2 | , The University of Vermont 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ogr2osm.py 2 | ========== 3 | 4 | [![test-py2](https://github.com/pnorman/ogr2osm/actions/workflows/test_py2.yml/badge.svg)](https://github.com/pnorman/ogr2osm/actions/workflows/test_py2.yml) [![test-py3](https://github.com/pnorman/ogr2osm/actions/workflows/test_py3.yml/badge.svg)](https://github.com/pnorman/ogr2osm/actions/workflows/test_py3.yml) 5 | 6 | A tool for converting ogr-readable files like shapefiles into .osm data 7 | 8 | !!! Notice !!! 9 | -------------- 10 | 11 | This version is no longer maintained, do not file new issues or pull requests here. Development will continue [here](https://github.com/roelderickx/ogr2osm). 12 | 13 | Installation 14 | ------------ 15 | 16 | ogr2osm requires gdal with python bindings. Depending on the file formats 17 | you want to read you may have to compile it yourself but there should be no 18 | issues with shapefiles. On Ubuntu you can run `sudo apt-get install -y python-gdal python-lxml` to get 19 | the software you need. 20 | 21 | It also makes use of lxml. Although it should fall back to builtin XML implementations seamlessly these are less likely to be tested and will most likely run much slower. 22 | 23 | To install ogr2osm and download the default translations the following command 24 | can be used: 25 | 26 | git clone --recursive https://github.com/pnorman/ogr2osm 27 | 28 | To update 29 | 30 | cd ogr2osm 31 | git pull 32 | git submodule update 33 | 34 | About 35 | ----- 36 | 37 | This version of ogr2osm is based on 38 | [Andrew Guertin's version for UVM](https://github.com/andrewguertin/ogr2osm) 39 | which is in turn based on Ivan Ortega's version from the OSM SVN server. 40 | 41 | ogr2osm will read any data source that ogr can read and handle reprojection for 42 | you. It takes a python file to translate external data source tags into OSM 43 | tags, allowing you to use complicated logic. If no translation is specified it 44 | will use an identity translation, carrying all tags from the source to the .osm 45 | output. 46 | 47 | Import Cautions 48 | --------------- 49 | Anyone planning an import into OpenStreetMap should read and review the import 50 | guidelines located [on the wiki](http://wiki.openstreetmap.org/wiki/Import/Guidelines). 51 | When writing your translation file you should look at other examples and 52 | carefully consider each external data source tag to see if it should be 53 | converted to an OSM tag. 54 | 55 | Usage 56 | ----- 57 | 58 | Usage: ogr2osm.py SRCFILE 59 | 60 | Options: 61 | -h, --help show this help message and exit 62 | -t TRANSLATION, --translation=TRANSLATION 63 | Select the attribute-tags translation method. See the 64 | translations/ directory for valid values. 65 | -o OUTPUT, --output=OUTPUT 66 | Set destination .osm file name and location. 67 | -e EPSG_CODE, --epsg=EPSG_CODE 68 | EPSG code of source file. Do not include the 'EPSG:' 69 | prefix. If specified, overrides projection from source 70 | metadata if it exists. 71 | -p PROJ4_STRING, --proj4=PROJ4_STRING 72 | PROJ.4 string. If specified, overrides projection from 73 | source metadata if it exists. 74 | -v, --verbose 75 | -d, --debug-tags Output the tags for every feature parsed. 76 | -f, --force Force overwrite of output file. 77 | --encoding=ENCODING Encoding of the source file. If specified, overrides 78 | the default of utf-8 79 | --significant-digits=SIGNIFICANTDIGITS 80 | Number of decimal places for coordinates 81 | --rounding-digits=ROUNDINGDIGITS 82 | Number of decimal places for rounding 83 | --no-memory-copy Do not make an in-memory working copy 84 | --no-upload-false Omit upload=false from the completed file to surpress 85 | JOSM warnings when uploading. 86 | --never-download Prevent JOSM from downloading more data to this file. 87 | --never-upload Completely disables all upload commands for this file 88 | in JOSM, rather than merely showing a warning before 89 | uploading. 90 | --locked Prevent any changes to this file in JOSM, such as 91 | editing or downloading, and also prevents uploads. 92 | Implies upload="never" and download="never". 93 | --id=ID ID to start counting from for the output file. 94 | Defaults to 0. 95 | -------------------------------------------------------------------------------- /geom.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Copyright (c) 2012-2013 Paul Norman 4 | # 5 | # Released under the MIT license, as given in the file LICENSE, which must 6 | # accompany any distribution of this code. 7 | 8 | # Classes 9 | class Geometry(object): 10 | elementIdCounter = 0 11 | elementIdCounterIncr = -1 12 | geometries = [] 13 | def __init__(self): 14 | self.id = getNewID() 15 | self.parents = set() 16 | Geometry.geometries.append(self) 17 | def replacejwithi(self, i, j): 18 | pass 19 | def addparent(self, parent): 20 | self.parents.add(parent) 21 | def removeparent(self, parent, shoulddestroy=True): 22 | self.parents.discard(parent) 23 | if shoulddestroy and len(self.parents) == 0: 24 | Geometry.geometries.remove(self) 25 | 26 | # Helper function to get a new ID 27 | def getNewID(): 28 | Geometry.elementIdCounter += Geometry.elementIdCounterIncr 29 | return Geometry.elementIdCounter 30 | 31 | class Point(Geometry): 32 | def __init__(self, x, y): 33 | Geometry.__init__(self) 34 | self.x = x 35 | self.y = y 36 | def replacejwithi(self, i, j): 37 | pass 38 | 39 | class Way(Geometry): 40 | def __init__(self): 41 | Geometry.__init__(self) 42 | self.points = [] 43 | def replacejwithi(self, i, j): 44 | self.points = [i if x == j else x for x in self.points] 45 | j.removeparent(self) 46 | i.addparent(self) 47 | 48 | class Relation(Geometry): 49 | def __init__(self): 50 | Geometry.__init__(self) 51 | self.members = [] 52 | def replacejwithi(self, i, j): 53 | self.members = [(i, x[1]) if x[0] == j else x for x in self.members] 54 | j.removeparent(self) 55 | i.addparent(self) 56 | 57 | class Feature(object): 58 | features = [] 59 | def __init__(self): 60 | self.geometry = None 61 | self.tags = {} 62 | Feature.features.append(self) 63 | def replacejwithi(self, i, j): 64 | if self.geometry == j: 65 | self.geometry = i 66 | j.removeparent(self) 67 | i.addparent(self) 68 | -------------------------------------------------------------------------------- /ogr2osm.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | ''' ogr2osm beta 5 | 6 | This program takes any vector data understadable by OGR and outputs an OSM file 7 | with that data. 8 | 9 | By default tags will be naively copied from the input data. Hooks are provided 10 | so that, with a little python programming, you can translate the tags however 11 | you like. More hooks are provided so you can filter or even modify the features 12 | themselves. 13 | 14 | To use the hooks, create a file in the translations/ directory called myfile.py 15 | and run ogr2osm.py -t myfile. This file should define a function with the name 16 | of each hook you want to use. For an example, see the uvmtrans.py file. 17 | 18 | The program will use projection metadata from the source, if it has any. If 19 | there is no projection information, or if you want to override it, you can use 20 | -e or -p to specify an EPSG code or Proj.4 string, respectively. If there is no 21 | projection metadata and you do not specify one, EPSG:4326 will be used (WGS84 22 | latitude-longitude) 23 | 24 | For additional usage information, run ogr2osm.py --help 25 | 26 | Copyright (c) 2012-2013 Paul Norman , Sebastiaan Couwenberg 27 | , The University of Vermont 28 | 29 | Released under the MIT license, as given in the file LICENSE, which must 30 | accompany any distribution of this code. 31 | 32 | Based very heavily on code released under the following terms: 33 | 34 | (c) Iván Sánchez Ortega, 2009 35 | 36 | ############################################################################### 37 | # "THE BEER-WARE LICENSE": # 38 | # wrote this file. As long as you retain this notice # 39 | # you can do whatever you want with this stuff. If we meet some day, and you # 40 | # think this stuff is worth it, you can buy me a beer in return. # 41 | ############################################################################### 42 | 43 | ''' 44 | 45 | 46 | import sys 47 | import os 48 | import optparse 49 | import re 50 | 51 | from osgeo import ogr 52 | from osgeo import osr 53 | from geom import * 54 | 55 | from datetime import datetime 56 | 57 | # import logging and set logging level to DEBUG 58 | import logging as l 59 | l.basicConfig(level=l.DEBUG, format="%(message)s") 60 | 61 | # Determine major Python version is 2 or 3 62 | IS_PYTHON2 = sys.version_info < (3, 0) 63 | 64 | ''' 65 | 66 | See http://lxml.de/tutorial.html for the source of the includes 67 | 68 | lxml should be the fastest method 69 | 70 | ''' 71 | 72 | try: 73 | from lxml import etree 74 | l.debug("running with lxml.etree") 75 | except ImportError: 76 | try: 77 | # Python 2.5 78 | import xml.etree.ElementTree as etree 79 | l.debug("running with ElementTree on Python 2.5+") 80 | except ImportError: 81 | try: 82 | # normal cElementTree install 83 | import cElementTree as etree 84 | l.debug("running with cElementTree") 85 | except ImportError: 86 | try: 87 | # normal ElementTree install 88 | import elementtree.ElementTree as etree 89 | l.debug("running with ElementTree") 90 | except ImportError: 91 | l.error("Failed to import ElementTree from any known place") 92 | raise 93 | 94 | 95 | # Initialize 96 | UNIQUE_NODE_INDEX = {} 97 | 98 | 99 | def openData(source): 100 | if re.match('^PG:', source): 101 | return openDatabaseSource(source) 102 | else: 103 | return getFileData(source) 104 | 105 | 106 | def openDatabaseSource(source): 107 | dataSource = ogr.Open(source, 0) # 0 means read-only 108 | if dataSource is None: 109 | l.error('OGR failed to open connection to' + source) 110 | sys.exit(1) 111 | else: 112 | return dataSource 113 | 114 | 115 | def getFileData(filename): 116 | ogr_accessmethods = [ "/vsicurl/", "/vsicurl_streaming/", "/vsisubfile/", 117 | "/vsistdin/" ] 118 | ogr_filemethods = [ "/vsisparse/", "/vsigzip/", "/vsitar/", "/vsizip/" ] 119 | ogr_unsupported = [ "/vsimem/", "/vsistdout/", ] 120 | has_unsup = [ m for m in ogr_unsupported if m[1:-1] in filename.split('/') ] 121 | if has_unsup: 122 | parser.error("Unsupported OGR access method(s) found: %s." 123 | % str(has_unsup)[1:-1]) 124 | if not any([ m[1:-1] in filename.split('/') for m in ogr_accessmethods ]): 125 | # Not using any ogr_accessmethods 126 | real_filename = filename 127 | for fm in ogr_filemethods: 128 | if filename.find(fm) == 0: 129 | real_filename = filename[len(fm):] 130 | break 131 | if not os.path.exists(real_filename): 132 | parser.error("the file '%s' does not exist" % (real_filename)) 133 | if len(filename) == len(real_filename): 134 | if filename.endswith('.gz'): 135 | filename = '/vsigzip/' + filename 136 | elif filename.endswith('.tar') or filename.endswith('.tgz') or \ 137 | filename.endswith('.tar.gz'): 138 | filename = '/vsitar/' + filename 139 | elif filename.endswith('.zip'): 140 | filename = '/vsizip/' + filename 141 | 142 | fileDataSource = ogr.Open(filename, 0) # 0 means read-only 143 | if fileDataSource is None: 144 | l.error('OGR failed to open ' + filename + ', format may be unsupported') 145 | sys.exit(1) 146 | if OPTIONS.noMemoryCopy: 147 | return fileDataSource 148 | else: 149 | memoryDataSource = ogr.GetDriverByName('Memory').CopyDataSource(fileDataSource,'memoryCopy') 150 | return memoryDataSource 151 | 152 | 153 | def parseData(dataSource): 154 | l.debug("Parsing data") 155 | global TRANSLATIONS 156 | if OPTIONS.sqlQuery: 157 | layer = dataSource.ExecuteSQL(OPTIONS.sqlQuery) 158 | layer.ResetReading() 159 | parseLayer(TRANSLATIONS.filterLayer(layer)) 160 | else: 161 | for i in range(dataSource.GetLayerCount()): 162 | layer = dataSource.GetLayer(i) 163 | layer.ResetReading() 164 | parseLayer(TRANSLATIONS.filterLayer(layer)) 165 | 166 | 167 | def getTransform(layer): 168 | global OPTIONS 169 | # First check if the user supplied a projection, then check the layer, 170 | # then fall back to a default 171 | spatialRef = None 172 | if OPTIONS.sourcePROJ4: 173 | spatialRef = osr.SpatialReference() 174 | spatialRef.ImportFromProj4(OPTIONS.sourcePROJ4) 175 | elif OPTIONS.sourceEPSG: 176 | spatialRef = osr.SpatialReference() 177 | spatialRef.ImportFromEPSG(OPTIONS.sourceEPSG) 178 | else: 179 | spatialRef = layer.GetSpatialRef() 180 | if spatialRef != None: 181 | l.info("Detected projection metadata:\n" + str(spatialRef)) 182 | else: 183 | l.info("No projection metadata, falling back to EPSG:4326") 184 | 185 | if spatialRef == None: 186 | # No source proj specified yet? Then default to do no reprojection. 187 | # Some python magic: skip reprojection altogether by using a dummy 188 | # lamdba funcion. Otherwise, the lambda will be a call to the OGR 189 | # reprojection stuff. 190 | reproject = lambda geometry: None 191 | else: 192 | destSpatialRef = osr.SpatialReference() 193 | try: 194 | destSpatialRef.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER) 195 | except AttributeError: 196 | pass 197 | # Destionation projection will *always* be EPSG:4326, WGS84 lat-lon 198 | destSpatialRef.ImportFromEPSG(4326) 199 | coordTrans = osr.CoordinateTransformation(spatialRef, destSpatialRef) 200 | reproject = lambda geometry: geometry.Transform(coordTrans) 201 | 202 | return reproject 203 | 204 | 205 | def getLayerFields(layer): 206 | featureDefinition = layer.GetLayerDefn() 207 | fieldNames = [] 208 | fieldCount = featureDefinition.GetFieldCount() 209 | for j in range(fieldCount): 210 | fieldNames.append(featureDefinition.GetFieldDefn(j).GetNameRef()) 211 | return fieldNames 212 | 213 | 214 | def getFeatureTags(ogrfeature, fieldNames): 215 | ''' 216 | This function builds up a dictionary with the source data attributes and passes them to the filterTags function, returning the result. 217 | ''' 218 | tags = {} 219 | for i in range(len(fieldNames)): 220 | # The field needs to be put into the appropriate encoding and leading or trailing spaces stripped 221 | if IS_PYTHON2: 222 | tags[fieldNames[i].decode(OPTIONS.encoding)] = ogrfeature.GetFieldAsString(i).decode(OPTIONS.encoding).strip() 223 | else: 224 | tags[fieldNames[i]] = ogrfeature.GetFieldAsString(i).strip() 225 | return TRANSLATIONS.filterTags(tags) 226 | 227 | 228 | def parseLayer(layer): 229 | if layer is None: 230 | return 231 | fieldNames = getLayerFields(layer) 232 | reproject = getTransform(layer) 233 | 234 | for j in range(layer.GetFeatureCount()): 235 | ogrfeature = layer.GetNextFeature() 236 | parseFeature(TRANSLATIONS.filterFeature(ogrfeature, fieldNames, reproject), fieldNames, reproject) 237 | 238 | 239 | def parseFeature(ogrfeature, fieldNames, reproject): 240 | if ogrfeature is None: 241 | return 242 | 243 | ogrgeometry = ogrfeature.GetGeometryRef() 244 | if ogrgeometry is None: 245 | return 246 | reproject(ogrgeometry) 247 | geometries = parseGeometry([ogrgeometry]) 248 | 249 | for geometry in geometries: 250 | if geometry is None: 251 | return 252 | 253 | feature = Feature() 254 | feature.tags = getFeatureTags(ogrfeature, fieldNames) 255 | feature.geometry = geometry 256 | geometry.addparent(feature) 257 | 258 | TRANSLATIONS.filterFeaturePost(feature, ogrfeature, ogrgeometry) 259 | 260 | 261 | def parseGeometry(ogrgeometries): 262 | returngeometries = [] 263 | for ogrgeometry in ogrgeometries: 264 | geometryType = ogrgeometry.GetGeometryType() 265 | 266 | if (geometryType == ogr.wkbPoint or 267 | geometryType == ogr.wkbPoint25D): 268 | returngeometries.append(parsePoint(ogrgeometry)) 269 | elif (geometryType == ogr.wkbLineString or 270 | geometryType == ogr.wkbLinearRing or 271 | geometryType == ogr.wkbLineString25D): 272 | # geometryType == ogr.wkbLinearRing25D does not exist 273 | returngeometries.append(parseLineString(ogrgeometry)) 274 | elif (geometryType == ogr.wkbPolygon or 275 | geometryType == ogr.wkbPolygon25D): 276 | returngeometries.append(parsePolygon(ogrgeometry)) 277 | elif (geometryType == ogr.wkbMultiPoint or 278 | geometryType == ogr.wkbMultiLineString or 279 | geometryType == ogr.wkbMultiPolygon or 280 | geometryType == ogr.wkbGeometryCollection or 281 | geometryType == ogr.wkbMultiPoint25D or 282 | geometryType == ogr.wkbMultiLineString25D or 283 | geometryType == ogr.wkbMultiPolygon25D or 284 | geometryType == ogr.wkbGeometryCollection25D): 285 | returngeometries.extend(parseCollection(ogrgeometry)) 286 | else: 287 | l.warning("unhandled geometry, type: " + str(geometryType)) 288 | returngeometries.append(None) 289 | 290 | return returngeometries 291 | 292 | 293 | def addPoint(x, y): 294 | global UNIQUE_NODE_INDEX 295 | rx = int(round(x * 10**OPTIONS.roundingDigits)) 296 | ry = int(round(y * 10**OPTIONS.roundingDigits)) 297 | if (rx, ry) in UNIQUE_NODE_INDEX: 298 | return Geometry.geometries[UNIQUE_NODE_INDEX[(rx, ry)]] 299 | else: 300 | UNIQUE_NODE_INDEX[(rx, ry)] = len(Geometry.geometries) 301 | point = Point(int(round(x*10**OPTIONS.significantDigits)), int(round(y*10**OPTIONS.significantDigits))) 302 | return point 303 | 304 | 305 | def parsePoint(ogrgeometry): 306 | return addPoint(ogrgeometry.GetX(), ogrgeometry.GetY()) 307 | 308 | 309 | def parseLineString(ogrgeometry): 310 | geometry = Way() 311 | # LineString.GetPoint() returns a tuple, so we can't call parsePoint on it 312 | # and instead have to create the point ourself 313 | for i in range(ogrgeometry.GetPointCount()): 314 | (x, y, unused) = ogrgeometry.GetPoint(i) 315 | mypoint = addPoint(x, y) 316 | geometry.points.append(mypoint) 317 | mypoint.addparent(geometry) 318 | return geometry 319 | 320 | 321 | def parsePolygon(ogrgeometry): 322 | # Special case polygons with only one ring. This does not (or at least 323 | # should not) change behavior when simplify relations is turned on. 324 | if ogrgeometry.GetGeometryCount() == 0: 325 | l.warning("Polygon with no rings?") 326 | elif ogrgeometry.GetGeometryCount() == 1: 327 | result = parseLineString(ogrgeometry.GetGeometryRef(0)) 328 | if len(result.points) > OPTIONS.maxNodesPerWay: 329 | global LONG_WAYS_FROM_POLYGONS 330 | LONG_WAYS_FROM_POLYGONS.add(result) 331 | return result 332 | else: 333 | geometry = Relation() 334 | try: 335 | exterior = parseLineString(ogrgeometry.GetGeometryRef(0)) 336 | exterior.addparent(geometry) 337 | except: 338 | l.warning("Polygon with no exterior ring?") 339 | return None 340 | geometry.members.append((exterior, "outer")) 341 | for i in range(1, ogrgeometry.GetGeometryCount()): 342 | interior = parseLineString(ogrgeometry.GetGeometryRef(i)) 343 | interior.addparent(geometry) 344 | geometry.members.append((interior, "inner")) 345 | return geometry 346 | 347 | 348 | def parseCollection(ogrgeometry): 349 | # OGR MultiPolygon maps easily to osm multipolygon, so special case it 350 | # TODO: Does anything else need special casing? 351 | geometryType = ogrgeometry.GetGeometryType() 352 | if (geometryType == ogr.wkbMultiPolygon or 353 | geometryType == ogr.wkbMultiPolygon25D): 354 | if ogrgeometry.GetGeometryCount() > 1: 355 | geometry = Relation() 356 | for polygon in range(ogrgeometry.GetGeometryCount()): 357 | exterior = parseLineString(ogrgeometry.GetGeometryRef(polygon).GetGeometryRef(0)) 358 | exterior.addparent(geometry) 359 | geometry.members.append((exterior, "outer")) 360 | for i in range(1, ogrgeometry.GetGeometryRef(polygon).GetGeometryCount()): 361 | interior = parseLineString(ogrgeometry.GetGeometryRef(polygon).GetGeometryRef(i)) 362 | interior.addparent(geometry) 363 | geometry.members.append((interior, "inner")) 364 | return [geometry] 365 | else: 366 | return [parsePolygon(ogrgeometry.GetGeometryRef(0))] 367 | elif (geometryType == ogr.wkbMultiLineString or 368 | geometryType == ogr.wkbMultiLineString25D): 369 | geometries = [] 370 | for linestring in range(ogrgeometry.GetGeometryCount()): 371 | geometries.append(parseLineString(ogrgeometry.GetGeometryRef(linestring))) 372 | return geometries 373 | else: 374 | geometry = Relation() 375 | for i in range(ogrgeometry.GetGeometryCount()): 376 | member = parseGeometry(ogrgeometry.GetGeometryRef(i)) 377 | member.addparent(geometry) 378 | geometry.members.append((member, "member")) 379 | return [geometry] 380 | 381 | 382 | def mergeWayPoints(): 383 | l.debug("Merging duplicate points in ways") 384 | ways = [geom for geom in Geometry.geometries if type(geom) == Way] 385 | 386 | # Remove duplicate points from ways, 387 | # a duplicate has the same id as its predecessor 388 | for way in ways: 389 | previous = OPTIONS.id 390 | merged_points = [] 391 | 392 | for node in way.points: 393 | if previous == OPTIONS.id or previous != node.id: 394 | merged_points.append(node) 395 | previous = node.id 396 | 397 | if len(merged_points) > 0: 398 | way.points = merged_points 399 | 400 | 401 | def splitLongWays(max_points_in_way, waysToCreateRelationFor): 402 | l.debug("Splitting long ways") 403 | ways = [geom for geom in Geometry.geometries if type(geom) == Way] 404 | 405 | featuresmap = {feature.geometry : feature for feature in Feature.features} 406 | 407 | 408 | for way in ways: 409 | is_way_in_relation = len([p for p in way.parents if type(p) == Relation]) > 0 410 | if len(way.points) > max_points_in_way: 411 | way_parts = splitWay(way, max_points_in_way, featuresmap, is_way_in_relation) 412 | if not is_way_in_relation: 413 | if way in waysToCreateRelationFor: 414 | mergeIntoNewRelation(way_parts) 415 | else: 416 | for rel in way.parents: 417 | splitWayInRelation(rel, way_parts) 418 | 419 | 420 | def splitWay(way, max_points_in_way, features_map, is_way_in_relation): 421 | new_points = [way.points[i:i + max_points_in_way] for i in range(0, len(way.points), max_points_in_way - 1)] 422 | new_ways = [way, ] + [Way() for i in range(len(new_points) - 1)] 423 | 424 | if not is_way_in_relation: 425 | way_tags = features_map[way].tags 426 | 427 | for new_way in new_ways: 428 | if new_way != way: 429 | feat = Feature() 430 | feat.geometry = new_way 431 | feat.tags = way_tags 432 | 433 | for new_way, points in zip(new_ways, new_points): 434 | new_way.points = points 435 | if new_way.id != way.id: 436 | for point in points: 437 | point.removeparent(way, shoulddestroy=False) 438 | point.addparent(new_way) 439 | 440 | return new_ways 441 | 442 | 443 | def mergeIntoNewRelation(way_parts): 444 | new_relation = Relation() 445 | feat = Feature() 446 | feat.geometry = new_relation 447 | new_relation.members = [(way, "outer") for way in way_parts] 448 | for way in way_parts: 449 | way.addparent(new_relation) 450 | 451 | 452 | def splitWayInRelation(rel, way_parts): 453 | way_roles = [m[1] for m in rel.members if m[0] == way_parts[0]] 454 | way_role = "" if len(way_roles) == 0 else way_roles[0] 455 | for way in way_parts[1:]: 456 | rel.members.append((way, way_role)) 457 | 458 | 459 | def output(): 460 | l.debug("Outputting XML") 461 | # First, set up a few data structures for optimization purposes 462 | nodes = [geom for geom in Geometry.geometries if type(geom) == Point] 463 | ways = [geom for geom in Geometry.geometries if type(geom) == Way] 464 | relations = [geom for geom in Geometry.geometries if type(geom) == Relation] 465 | featuresmap = {feature.geometry : feature for feature in Feature.features} 466 | 467 | # Open up the output file with the system default buffering 468 | with open(OPTIONS.outputFile, 'w', buffering=-1) as f: 469 | 470 | dec_string = '\n') 550 | 551 | 552 | def main(): 553 | global TRANSLATIONS 554 | global OPTIONS 555 | global UNIQUE_NODE_INDEX 556 | global LONG_WAYS_FROM_POLYGONS 557 | 558 | # Setup program usage 559 | usage = """%prog SRCFILE 560 | 561 | SRCFILE can be a file path or a org PostgreSQL connection string such as: 562 | "PG:dbname=pdx_bldgs user=emma host=localhost" (including the quotes)""" 563 | parser = optparse.OptionParser(usage=usage) 564 | parser.add_option("-t", "--translation", dest="translationMethod", 565 | metavar="TRANSLATION", 566 | help="Select the attribute-tags translation method. See " + 567 | "the translations/ directory for valid values.") 568 | parser.add_option("-o", "--output", dest="outputFile", metavar="OUTPUT", 569 | help="Set destination .osm file name and location.") 570 | parser.add_option("-e", "--epsg", dest="sourceEPSG", metavar="EPSG_CODE", 571 | help="EPSG code of source file. Do not include the " + 572 | "'EPSG:' prefix. If specified, overrides projection " + 573 | "from source metadata if it exists.") 574 | parser.add_option("-p", "--proj4", dest="sourcePROJ4", metavar="PROJ4_STRING", 575 | help="PROJ.4 string. If specified, overrides projection " + 576 | "from source metadata if it exists.") 577 | parser.add_option("-v", "--verbose", dest="verbose", action="store_true") 578 | parser.add_option("-d", "--debug-tags", dest="debugTags", action="store_true", 579 | help="Output the tags for every feature parsed.") 580 | parser.add_option("-f", "--force", dest="forceOverwrite", action="store_true", 581 | help="Force overwrite of output file.") 582 | 583 | parser.add_option("--encoding", dest="encoding", 584 | help="Encoding of the source file. If specified, overrides " + 585 | "the default of utf-8", default="utf-8") 586 | 587 | parser.add_option("--significant-digits", dest="significantDigits", type=int, 588 | help="Number of decimal places for coordinates", default=9) 589 | 590 | parser.add_option("--rounding-digits", dest="roundingDigits", type=int, 591 | help="Number of decimal places for rounding", default=7) 592 | 593 | parser.add_option("--no-memory-copy", dest="noMemoryCopy", action="store_true", 594 | help="Do not make an in-memory working copy") 595 | 596 | parser.add_option("--no-upload-false", dest="noUploadFalse", action="store_true", 597 | help="Omit upload=false from the completed file to surpress JOSM warnings when uploading.") 598 | 599 | parser.add_option("--never-download", dest="neverDownload", action="store_true", 600 | help="Prevent JOSM from downloading more data to this file.") 601 | 602 | parser.add_option("--never-upload", dest="neverUpload", action="store_true", 603 | help="Completely disables all upload commands for this file in JOSM, " + 604 | "rather than merely showing a warning before uploading.") 605 | 606 | parser.add_option("--locked", dest="locked", action="store_true", 607 | help="Prevent any changes to this file in JOSM, " + 608 | "such as editing or downloading, and also prevents uploads. " + 609 | "Implies upload=\"never\" and download=\"never\".") 610 | 611 | parser.add_option("--id", dest="id", type=int, default=0, 612 | help="ID to start counting from for the output file. Defaults to 0.") 613 | 614 | parser.add_option("--idfile", dest="idfile", type=str, default=None, 615 | help="Read ID to start counting from from a file.") 616 | 617 | parser.add_option("--split-ways", dest="maxNodesPerWay", type=int, default=1800, 618 | help="Split ways with more than the specified number of nodes. Defaults to 1800. " + 619 | "Any value below 2 - do not split.") 620 | 621 | parser.add_option("--saveid", dest="saveid", type=str, default=None, 622 | help="Save last ID after execution to a file.") 623 | 624 | # Positive IDs can cause big problems if used inappropriately so hide the help for this 625 | parser.add_option("--positive-id", dest="positiveID", action="store_true", 626 | help=optparse.SUPPRESS_HELP) 627 | 628 | # Add version attributes. Again, this can cause big problems so surpress the help 629 | parser.add_option("--add-version", dest="addVersion", action="store_true", 630 | help=optparse.SUPPRESS_HELP) 631 | 632 | # Add timestamp attributes. Again, this can cause big problems so surpress the help 633 | parser.add_option("--add-timestamp", dest="addTimestamp", action="store_true", 634 | help=optparse.SUPPRESS_HELP) 635 | 636 | parser.add_option("--sql", dest="sqlQuery", type=str, default=None, 637 | help="SQL query to execute on a PostgreSQL source") 638 | 639 | parser.set_defaults(sourceEPSG=None, sourcePROJ4=None, verbose=False, 640 | debugTags=False, 641 | translationMethod=None, outputFile=None, 642 | forceOverwrite=False, noUploadFalse=False, 643 | neverDownload=False, neverUpload=False, 644 | locked=False) 645 | 646 | # Parse and process arguments 647 | (OPTIONS, args) = parser.parse_args() 648 | 649 | try: 650 | if OPTIONS.sourceEPSG: 651 | OPTIONS.sourceEPSG = int(OPTIONS.sourceEPSG) 652 | except: 653 | parser.error("EPSG code must be numeric (e.g. '4326', not 'epsg:4326')") 654 | 655 | if len(args) < 1: 656 | parser.print_help() 657 | parser.error("you must specify a source filename") 658 | elif len(args) > 1: 659 | parser.error("you have specified too many arguments, " + 660 | "only supply the source filename") 661 | 662 | if OPTIONS.addTimestamp: 663 | from datetime import datetime 664 | 665 | # Input and output file 666 | # if no output file given, use the basename of the source but with .osm 667 | source = args[0] 668 | sourceIsDatabase = bool(re.match('^PG:', source)) 669 | 670 | if OPTIONS.outputFile is not None: 671 | OPTIONS.outputFile = os.path.realpath(OPTIONS.outputFile) 672 | elif sourceIsDatabase: 673 | parser.error("ERROR: An output file must be explicitly specified when using a database source") 674 | else: 675 | (base, ext) = os.path.splitext(os.path.basename(source)) 676 | OPTIONS.outputFile = os.path.join(os.getcwd(), base + ".osm") 677 | 678 | if OPTIONS.sqlQuery and not sourceIsDatabase: 679 | parser.error("ERROR: You must use a database source when specifying a query with --sql") 680 | 681 | if not OPTIONS.forceOverwrite and os.path.exists(OPTIONS.outputFile): 682 | parser.error("ERROR: output file '%s' exists" % (OPTIONS.outputFile)) 683 | l.info("Preparing to convert '%s' to '%s'." % (source, OPTIONS.outputFile)) 684 | 685 | # Projection 686 | if not OPTIONS.sourcePROJ4 and not OPTIONS.sourceEPSG: 687 | l.info("Will try to detect projection from source metadata, or fall back to EPSG:4326") 688 | elif OPTIONS.sourcePROJ4: 689 | l.info("Will use the PROJ.4 string: " + OPTIONS.sourcePROJ4) 690 | elif OPTIONS.sourceEPSG: 691 | l.info("Will use EPSG:" + str(OPTIONS.sourceEPSG)) 692 | 693 | # Stuff needed for locating translation methods 694 | if OPTIONS.translationMethod: 695 | # add dirs to path if necessary 696 | (root, ext) = os.path.splitext(OPTIONS.translationMethod) 697 | if os.path.exists(OPTIONS.translationMethod) and ext == '.py': 698 | # user supplied translation file directly 699 | sys.path.insert(0, os.path.dirname(root)) 700 | else: 701 | # first check translations in the subdir translations of cwd 702 | sys.path.insert(0, os.path.join(os.getcwd(), "translations")) 703 | # then check subdir of script dir 704 | sys.path.insert(1, os.path.join(os.path.dirname(__file__), "translations")) 705 | # (the cwd will also be checked implicityly) 706 | 707 | # strip .py if present, as import wants just the module name 708 | if ext == '.py': 709 | OPTIONS.translationMethod = os.path.basename(root) 710 | 711 | try: 712 | TRANSLATIONS = __import__(OPTIONS.translationMethod, fromlist = ['']) 713 | except ImportError as e: 714 | parser.error("Could not load translation method '%s'. Translation " 715 | "script must be in your current directory, or in the " 716 | "translations/ subdirectory of your current or ogr2osm.py " 717 | "directory. The following directories have been considered: %s" 718 | % (OPTIONS.translationMethod, str(sys.path))) 719 | except SyntaxError as e: 720 | parser.error("Syntax error in '%s'. Translation script is malformed:\n%s" 721 | % (OPTIONS.translationMethod, e)) 722 | 723 | l.info("Successfully loaded '%s' translation method ('%s')." 724 | % (OPTIONS.translationMethod, os.path.realpath(TRANSLATIONS.__file__))) 725 | else: 726 | import types 727 | TRANSLATIONS = types.ModuleType("translationmodule") 728 | l.info("Using default translations") 729 | 730 | default_translations = [ 731 | ('filterLayer', lambda layer: layer), 732 | ('filterFeature', lambda feature, fieldNames, reproject: feature), 733 | ('filterTags', lambda tags: tags), 734 | ('filterFeaturePost', lambda feature, fieldNames, reproject: feature), 735 | ('preOutputTransform', lambda geometries, features: None), 736 | ] 737 | 738 | for (k, v) in default_translations: 739 | if hasattr(TRANSLATIONS, k) and getattr(TRANSLATIONS, k): 740 | l.debug("Using user " + k) 741 | else: 742 | l.debug("Using default " + k) 743 | setattr(TRANSLATIONS, k, v) 744 | 745 | Geometry.elementIdCounter = OPTIONS.id 746 | if OPTIONS.idfile: 747 | with open(OPTIONS.idfile, 'r') as ff: 748 | Geometry.elementIdCounter = int(ff.readline(20)) 749 | l.info("Starting counter value '%d' read from file '%s'." \ 750 | % (Geometry.elementIdCounter, OPTIONS.idfile)) 751 | 752 | if OPTIONS.positiveID: 753 | Geometry.elementIdCounterIncr = 1 # default is -1 754 | 755 | # Main flow 756 | data = openData(source) 757 | LONG_WAYS_FROM_POLYGONS = set() 758 | parseData(data) 759 | mergeWayPoints() 760 | if OPTIONS.maxNodesPerWay >= 2: 761 | splitLongWays(OPTIONS.maxNodesPerWay, LONG_WAYS_FROM_POLYGONS) 762 | TRANSLATIONS.preOutputTransform(Geometry.geometries, Feature.features) 763 | output() 764 | if OPTIONS.saveid: 765 | with open(OPTIONS.saveid, 'w') as ff: 766 | ff.write(str(Geometry.elementIdCounter)) 767 | l.info("Wrote elementIdCounter '%d' to file '%s'" 768 | % (Geometry.elementIdCounter, OPTIONS.saveid)) 769 | 770 | 771 | if __name__ == '__main__': 772 | main() 773 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | from setuptools import setup 5 | 6 | setup( 7 | name='ogr2osm', 8 | version='0.1', 9 | author='pnorman', 10 | author_email='penorman@mac.com', 11 | description="pnorman's version of UVM's Rewrite of ogr2osm", 12 | license='MIT', 13 | url='https://github.com/pnorman/ogr2osm/', 14 | py_modules=[ 15 | 'ogr2osm', 16 | 'geom', 17 | ], 18 | entry_points={ 19 | 'console_scripts': [ 20 | 'ogr2osm=ogr2osm:main', 21 | ] 22 | } 23 | ) 24 | -------------------------------------------------------------------------------- /testfiles/basic.t: -------------------------------------------------------------------------------- 1 | $ [ "$0" != "/bin/bash" ] || shopt -s expand_aliases 2 | $ [ -n "$PYTHON" ] || PYTHON="`which python`" 3 | $ alias ogr2osm="$PYTHON $TESTDIR/../ogr2osm.py" 4 | 5 | usage: 6 | 7 | $ ogr2osm -h 8 | running with lxml.etree 9 | Usage: ogr2osm.py SRCFILE 10 | 11 | SRCFILE can be a file path or a org PostgreSQL connection string such as: 12 | "PG:dbname=pdx_bldgs user=emma host=localhost" (including the quotes) 13 | 14 | Options: 15 | -h, --help show this help message and exit 16 | -t TRANSLATION, --translation=TRANSLATION 17 | Select the attribute-tags translation method. See the 18 | translations/ directory for valid values. 19 | -o OUTPUT, --output=OUTPUT 20 | Set destination .osm file name and location. 21 | -e EPSG_CODE, --epsg=EPSG_CODE 22 | EPSG code of source file. Do not include the 'EPSG:' 23 | prefix. If specified, overrides projection from source 24 | metadata if it exists. 25 | -p PROJ4_STRING, --proj4=PROJ4_STRING 26 | PROJ.4 string. If specified, overrides projection from 27 | source metadata if it exists. 28 | -v, --verbose 29 | -d, --debug-tags Output the tags for every feature parsed. 30 | -f, --force Force overwrite of output file. 31 | --encoding=ENCODING Encoding of the source file. If specified, overrides 32 | the default of utf-8 33 | --significant-digits=SIGNIFICANTDIGITS 34 | Number of decimal places for coordinates 35 | --rounding-digits=ROUNDINGDIGITS 36 | Number of decimal places for rounding 37 | --no-memory-copy Do not make an in-memory working copy 38 | --no-upload-false Omit upload=false from the completed file to surpress 39 | JOSM warnings when uploading. 40 | --never-download Prevent JOSM from downloading more data to this file. 41 | --never-upload Completely disables all upload commands for this file 42 | in JOSM, rather than merely showing a warning before 43 | uploading. 44 | --locked Prevent any changes to this file in JOSM, such as 45 | editing or downloading, and also prevents uploads. 46 | Implies upload="never" and download="never". 47 | --id=ID ID to start counting from for the output file. 48 | Defaults to 0. 49 | --idfile=IDFILE Read ID to start counting from from a file. 50 | --split-ways=MAXNODESPERWAY 51 | Split ways with more than the specified number of 52 | nodes. Defaults to 1800. Any value below 2 - do not 53 | split. 54 | --saveid=SAVEID Save last ID after execution to a file. 55 | --sql=SQLQUERY SQL query to execute on a PostgreSQL source 56 | 57 | test1: 58 | $ rm -f test1.osm 59 | $ ogr2osm $TESTDIR/shapefiles/test1.shp 60 | running with lxml.etree 61 | Preparing to convert .* (re) 62 | Will try to detect projection from source metadata, or fall back to EPSG:4326 63 | Using default translations 64 | Using default filterLayer 65 | Using default filterFeature 66 | Using default filterTags 67 | Using default filterFeaturePost 68 | Using default preOutputTransform 69 | Parsing data 70 | Detected projection metadata: 71 | PROJCS["NAD83 / UTM zone 10N", 72 | GEOGCS["NAD83", 73 | DATUM["North_American_Datum_1983", 74 | SPHEROID["GRS 1980",6378137,298.257222101, 75 | AUTHORITY["EPSG","7019"]], 76 | AUTHORITY["EPSG","6269"]], 77 | PRIMEM["Greenwich",0, 78 | AUTHORITY["EPSG","8901"]], 79 | UNIT["degree",0.0174532925199433, 80 | AUTHORITY["EPSG","9122"]], 81 | AUTHORITY["EPSG","4269"]], 82 | PROJECTION["Transverse_Mercator"], 83 | PARAMETER["latitude_of_origin",0], 84 | PARAMETER["central_meridian",-123], 85 | PARAMETER["scale_factor",0.9996], 86 | PARAMETER["false_easting",500000], 87 | PARAMETER["false_northing",0], 88 | UNIT["metre",1, 89 | AUTHORITY["EPSG","9001"]], 90 | AXIS["Easting",EAST], 91 | AXIS["Northing",NORTH], 92 | AUTHORITY["EPSG","26910"]] 93 | Merging duplicate points in ways 94 | Splitting long ways 95 | Outputting XML 96 | $ xmllint --format test1.osm | diff -uNr - $TESTDIR/test1.xml 97 | 98 | duplicatefile: 99 | $ ogr2osm $TESTDIR/shapefiles/test1.shp 100 | running with lxml.etree 101 | Usage: ogr2osm.py SRCFILE 102 | 103 | SRCFILE can be a file path or a org PostgreSQL connection string such as: 104 | "PG:dbname=pdx_bldgs user=emma host=localhost" (including the quotes) 105 | 106 | ogr2osm.py: error: ERROR: output file .*test1.osm' exists (re) 107 | [2] 108 | 109 | 110 | force: 111 | $ ogr2osm -f $TESTDIR/shapefiles/test1.shp 112 | running with lxml.etree 113 | Preparing to convert .* (re) 114 | Will try to detect projection from source metadata, or fall back to EPSG:4326 115 | Using default translations 116 | Using default filterLayer 117 | Using default filterFeature 118 | Using default filterTags 119 | Using default filterFeaturePost 120 | Using default preOutputTransform 121 | Parsing data 122 | Detected projection metadata: 123 | PROJCS["NAD83 / UTM zone 10N", 124 | GEOGCS["NAD83", 125 | DATUM["North_American_Datum_1983", 126 | SPHEROID["GRS 1980",6378137,298.257222101, 127 | AUTHORITY["EPSG","7019"]], 128 | AUTHORITY["EPSG","6269"]], 129 | PRIMEM["Greenwich",0, 130 | AUTHORITY["EPSG","8901"]], 131 | UNIT["degree",0.0174532925199433, 132 | AUTHORITY["EPSG","9122"]], 133 | AUTHORITY["EPSG","4269"]], 134 | PROJECTION["Transverse_Mercator"], 135 | PARAMETER["latitude_of_origin",0], 136 | PARAMETER["central_meridian",-123], 137 | PARAMETER["scale_factor",0.9996], 138 | PARAMETER["false_easting",500000], 139 | PARAMETER["false_northing",0], 140 | UNIT["metre",1, 141 | AUTHORITY["EPSG","9001"]], 142 | AXIS["Easting",EAST], 143 | AXIS["Northing",NORTH], 144 | AUTHORITY["EPSG","26910"]] 145 | Merging duplicate points in ways 146 | Splitting long ways 147 | Outputting XML 148 | $ xmllint --format test1.osm | diff -uNr - $TESTDIR/test1.xml 149 | 150 | nomemorycopy: 151 | $ ogr2osm -f --no-memory-copy $TESTDIR/shapefiles/test1.shp 152 | running with lxml.etree 153 | Preparing to convert .* (re) 154 | Will try to detect projection from source metadata, or fall back to EPSG:4326 155 | Using default translations 156 | Using default filterLayer 157 | Using default filterFeature 158 | Using default filterTags 159 | Using default filterFeaturePost 160 | Using default preOutputTransform 161 | Parsing data 162 | Detected projection metadata: 163 | PROJCS["NAD83 / UTM zone 10N", 164 | GEOGCS["NAD83", 165 | DATUM["North_American_Datum_1983", 166 | SPHEROID["GRS 1980",6378137,298.257222101, 167 | AUTHORITY["EPSG","7019"]], 168 | AUTHORITY["EPSG","6269"]], 169 | PRIMEM["Greenwich",0, 170 | AUTHORITY["EPSG","8901"]], 171 | UNIT["degree",0.0174532925199433, 172 | AUTHORITY["EPSG","9122"]], 173 | AUTHORITY["EPSG","4269"]], 174 | PROJECTION["Transverse_Mercator"], 175 | PARAMETER["latitude_of_origin",0], 176 | PARAMETER["central_meridian",-123], 177 | PARAMETER["scale_factor",0.9996], 178 | PARAMETER["false_easting",500000], 179 | PARAMETER["false_northing",0], 180 | UNIT["metre",1, 181 | AUTHORITY["EPSG","9001"]], 182 | AXIS["Easting",EAST], 183 | AXIS["Northing",NORTH], 184 | AUTHORITY["EPSG","26910"]] 185 | Merging duplicate points in ways 186 | Splitting long ways 187 | Outputting XML 188 | $ xmllint --format test1.osm | diff -uNr - $TESTDIR/test1.xml 189 | 190 | positiveid: 191 | $ ogr2osm -f --positive-id $TESTDIR/shapefiles/test1.shp 192 | running with lxml.etree 193 | Preparing to convert .* (re) 194 | Will try to detect projection from source metadata, or fall back to EPSG:4326 195 | Using default translations 196 | Using default filterLayer 197 | Using default filterFeature 198 | Using default filterTags 199 | Using default filterFeaturePost 200 | Using default preOutputTransform 201 | Parsing data 202 | Detected projection metadata: 203 | PROJCS["NAD83 / UTM zone 10N", 204 | GEOGCS["NAD83", 205 | DATUM["North_American_Datum_1983", 206 | SPHEROID["GRS 1980",6378137,298.257222101, 207 | AUTHORITY["EPSG","7019"]], 208 | AUTHORITY["EPSG","6269"]], 209 | PRIMEM["Greenwich",0, 210 | AUTHORITY["EPSG","8901"]], 211 | UNIT["degree",0.0174532925199433, 212 | AUTHORITY["EPSG","9122"]], 213 | AUTHORITY["EPSG","4269"]], 214 | PROJECTION["Transverse_Mercator"], 215 | PARAMETER["latitude_of_origin",0], 216 | PARAMETER["central_meridian",-123], 217 | PARAMETER["scale_factor",0.9996], 218 | PARAMETER["false_easting",500000], 219 | PARAMETER["false_northing",0], 220 | UNIT["metre",1, 221 | AUTHORITY["EPSG","9001"]], 222 | AXIS["Easting",EAST], 223 | AXIS["Northing",NORTH], 224 | AUTHORITY["EPSG","26910"]] 225 | Merging duplicate points in ways 226 | Splitting long ways 227 | Outputting XML 228 | $ xmllint --format test1.osm | diff -uNr - $TESTDIR/positiveid.xml 229 | 230 | version: 231 | $ ogr2osm -f --add-version $TESTDIR/shapefiles/test1.shp 232 | running with lxml.etree 233 | Preparing to convert .* (re) 234 | Will try to detect projection from source metadata, or fall back to EPSG:4326 235 | Using default translations 236 | Using default filterLayer 237 | Using default filterFeature 238 | Using default filterTags 239 | Using default filterFeaturePost 240 | Using default preOutputTransform 241 | Parsing data 242 | Detected projection metadata: 243 | PROJCS["NAD83 / UTM zone 10N", 244 | GEOGCS["NAD83", 245 | DATUM["North_American_Datum_1983", 246 | SPHEROID["GRS 1980",6378137,298.257222101, 247 | AUTHORITY["EPSG","7019"]], 248 | AUTHORITY["EPSG","6269"]], 249 | PRIMEM["Greenwich",0, 250 | AUTHORITY["EPSG","8901"]], 251 | UNIT["degree",0.0174532925199433, 252 | AUTHORITY["EPSG","9122"]], 253 | AUTHORITY["EPSG","4269"]], 254 | PROJECTION["Transverse_Mercator"], 255 | PARAMETER["latitude_of_origin",0], 256 | PARAMETER["central_meridian",-123], 257 | PARAMETER["scale_factor",0.9996], 258 | PARAMETER["false_easting",500000], 259 | PARAMETER["false_northing",0], 260 | UNIT["metre",1, 261 | AUTHORITY["EPSG","9001"]], 262 | AXIS["Easting",EAST], 263 | AXIS["Northing",NORTH], 264 | AUTHORITY["EPSG","26910"]] 265 | Merging duplicate points in ways 266 | Splitting long ways 267 | Outputting XML 268 | $ xmllint --format test1.osm | diff -uNr - $TESTDIR/version.xml 269 | 270 | timestamp: 271 | $ ogr2osm -f --add-timestamp $TESTDIR/shapefiles/test1.shp 272 | running with lxml.etree 273 | Preparing to convert .* (re) 274 | Will try to detect projection from source metadata, or fall back to EPSG:4326 275 | Using default translations 276 | Using default filterLayer 277 | Using default filterFeature 278 | Using default filterTags 279 | Using default filterFeaturePost 280 | Using default preOutputTransform 281 | Parsing data 282 | Detected projection metadata: 283 | PROJCS["NAD83 / UTM zone 10N", 284 | GEOGCS["NAD83", 285 | DATUM["North_American_Datum_1983", 286 | SPHEROID["GRS 1980",6378137,298.257222101, 287 | AUTHORITY["EPSG","7019"]], 288 | AUTHORITY["EPSG","6269"]], 289 | PRIMEM["Greenwich",0, 290 | AUTHORITY["EPSG","8901"]], 291 | UNIT["degree",0.0174532925199433, 292 | AUTHORITY["EPSG","9122"]], 293 | AUTHORITY["EPSG","4269"]], 294 | PROJECTION["Transverse_Mercator"], 295 | PARAMETER["latitude_of_origin",0], 296 | PARAMETER["central_meridian",-123], 297 | PARAMETER["scale_factor",0.9996], 298 | PARAMETER["false_easting",500000], 299 | PARAMETER["false_northing",0], 300 | UNIT["metre",1, 301 | AUTHORITY["EPSG","9001"]], 302 | AXIS["Easting",EAST], 303 | AXIS["Northing",NORTH], 304 | AUTHORITY["EPSG","26910"]] 305 | Merging duplicate points in ways 306 | Splitting long ways 307 | Outputting XML 308 | 309 | utf8: 310 | $ ogr2osm -f $TESTDIR/shapefiles/sp_usinas.shp 311 | running with lxml.etree 312 | Preparing to convert .* (re) 313 | Will try to detect projection from source metadata, or fall back to EPSG:4326 314 | Using default translations 315 | Using default filterLayer 316 | Using default filterFeature 317 | Using default filterTags 318 | Using default filterFeaturePost 319 | Using default preOutputTransform 320 | Parsing data 321 | Detected projection metadata: 322 | GEOGCS["SAD69", 323 | DATUM["South_American_Datum_1969", 324 | SPHEROID["GRS 1967 Modified",6378160,298.25, 325 | AUTHORITY["EPSG","7050"]], 326 | AUTHORITY["EPSG","6618"]], 327 | PRIMEM["Greenwich",0, 328 | AUTHORITY["EPSG","8901"]], 329 | UNIT["degree",0.0174532925199433, 330 | AUTHORITY["EPSG","9122"]], 331 | AXIS["Latitude",NORTH], 332 | AXIS["Longitude",EAST], 333 | AUTHORITY["EPSG","4618"]] 334 | Merging duplicate points in ways 335 | Splitting long ways 336 | Outputting XML 337 | $ xmllint --format sp_usinas.osm | diff -uNr - $TESTDIR/utf8.xml 338 | 339 | duplicatewaynodes: 340 | $ ogr2osm -f $TESTDIR/shapefiles/duplicate-way-nodes.gml 341 | running with lxml.etree 342 | Preparing to convert .* (re) 343 | Will try to detect projection from source metadata, or fall back to EPSG:4326 344 | Using default translations 345 | Using default filterLayer 346 | Using default filterFeature 347 | Using default filterTags 348 | Using default filterFeaturePost 349 | Using default preOutputTransform 350 | Parsing data 351 | No projection metadata, falling back to EPSG:4326 352 | Detected projection metadata: 353 | PROJCS["Amersfoort / RD New", 354 | GEOGCS["Amersfoort", 355 | DATUM["Amersfoort", 356 | SPHEROID["Bessel 1841",6377397.155,299.1528128, 357 | AUTHORITY["EPSG","7004"]], 358 | AUTHORITY["EPSG","6289"]], 359 | PRIMEM["Greenwich",0, 360 | AUTHORITY["EPSG","8901"]], 361 | UNIT["degree",0.0174532925199433, 362 | AUTHORITY["EPSG","9122"]], 363 | AUTHORITY["EPSG","4289"]], 364 | PROJECTION["Oblique_Stereographic"], 365 | PARAMETER["latitude_of_origin",52.1561605555556], 366 | PARAMETER["central_meridian",5.38763888888889], 367 | PARAMETER["scale_factor",0.9999079], 368 | PARAMETER["false_easting",155000], 369 | PARAMETER["false_northing",463000], 370 | UNIT["metre",1, 371 | AUTHORITY["EPSG","9001"]], 372 | AXIS["Easting",EAST], 373 | AXIS["Northing",NORTH], 374 | AUTHORITY["EPSG","28992"]] 375 | unhandled geometry, type: 10 376 | Detected projection metadata: 377 | PROJCS["Amersfoort / RD New", 378 | GEOGCS["Amersfoort", 379 | DATUM["Amersfoort", 380 | SPHEROID["Bessel 1841",6377397.155,299.1528128, 381 | AUTHORITY["EPSG","7004"]], 382 | AUTHORITY["EPSG","6289"]], 383 | PRIMEM["Greenwich",0, 384 | AUTHORITY["EPSG","8901"]], 385 | UNIT["degree",0.0174532925199433, 386 | AUTHORITY["EPSG","9122"]], 387 | AUTHORITY["EPSG","4289"]], 388 | PROJECTION["Oblique_Stereographic"], 389 | PARAMETER["latitude_of_origin",52.1561605555556], 390 | PARAMETER["central_meridian",5.38763888888889], 391 | PARAMETER["scale_factor",0.9999079], 392 | PARAMETER["false_easting",155000], 393 | PARAMETER["false_northing",463000], 394 | UNIT["metre",1, 395 | AUTHORITY["EPSG","9001"]], 396 | AXIS["Easting",EAST], 397 | AXIS["Northing",NORTH], 398 | AUTHORITY["EPSG","28992"]] 399 | Merging duplicate points in ways 400 | Splitting long ways 401 | Outputting XML 402 | $ xmllint --format duplicate-way-nodes.osm | diff -uNr - $TESTDIR/duplicate-way-nodes.xml 403 | 404 | require_output_file_when_using_db_source: 405 | 406 | $ ogr2osm "PG:dbname=test" 407 | running with lxml.etree 408 | Usage: ogr2osm.py SRCFILE 409 | 410 | SRCFILE can be a file path or a org PostgreSQL connection string such as: 411 | "PG:dbname=pdx_bldgs user=emma host=localhost" (including the quotes) 412 | 413 | ogr2osm.py: error: ERROR: An output file must be explicitly specified when using a database source 414 | [2] 415 | 416 | require_db_source_for_sql_query: 417 | 418 | $ ogr2osm $TESTDIR/shapefiles/test1.shp --sql="SELECT * FROM wombats" 419 | running with lxml.etree 420 | Usage: ogr2osm.py SRCFILE 421 | 422 | SRCFILE can be a file path or a org PostgreSQL connection string such as: 423 | "PG:dbname=pdx_bldgs user=emma host=localhost" (including the quotes) 424 | 425 | ogr2osm.py: error: ERROR: You must use a database source when specifying a query with --sql 426 | [2] 427 | -------------------------------------------------------------------------------- /testfiles/basic_py2.t: -------------------------------------------------------------------------------- 1 | $ [ "$0" != "/bin/bash" ] || shopt -s expand_aliases 2 | $ [ -n "$PYTHON" ] || PYTHON="`which python`" 3 | $ alias ogr2osm="$PYTHON $TESTDIR/../ogr2osm.py" 4 | 5 | usage: 6 | 7 | $ ogr2osm -h 8 | running with lxml.etree 9 | Usage: ogr2osm.py SRCFILE 10 | 11 | SRCFILE can be a file path or a org PostgreSQL connection string such as: 12 | "PG:dbname=pdx_bldgs user=emma host=localhost" (including the quotes) 13 | 14 | Options: 15 | -h, --help show this help message and exit 16 | -t TRANSLATION, --translation=TRANSLATION 17 | Select the attribute-tags translation method. See the 18 | translations/ directory for valid values. 19 | -o OUTPUT, --output=OUTPUT 20 | Set destination .osm file name and location. 21 | -e EPSG_CODE, --epsg=EPSG_CODE 22 | EPSG code of source file. Do not include the 'EPSG:' 23 | prefix. If specified, overrides projection from source 24 | metadata if it exists. 25 | -p PROJ4_STRING, --proj4=PROJ4_STRING 26 | PROJ.4 string. If specified, overrides projection from 27 | source metadata if it exists. 28 | -v, --verbose 29 | -d, --debug-tags Output the tags for every feature parsed. 30 | -f, --force Force overwrite of output file. 31 | --encoding=ENCODING Encoding of the source file. If specified, overrides 32 | the default of utf-8 33 | --significant-digits=SIGNIFICANTDIGITS 34 | Number of decimal places for coordinates 35 | --rounding-digits=ROUNDINGDIGITS 36 | Number of decimal places for rounding 37 | --no-memory-copy Do not make an in-memory working copy 38 | --no-upload-false Omit upload=false from the completed file to surpress 39 | JOSM warnings when uploading. 40 | --never-download Prevent JOSM from downloading more data to this file. 41 | --never-upload Completely disables all upload commands for this file 42 | in JOSM, rather than merely showing a warning before 43 | uploading. 44 | --locked Prevent any changes to this file in JOSM, such as 45 | editing or downloading, and also prevents uploads. 46 | Implies upload="never" and download="never". 47 | --id=ID ID to start counting from for the output file. 48 | Defaults to 0. 49 | --idfile=IDFILE Read ID to start counting from from a file. 50 | --split-ways=MAXNODESPERWAY 51 | Split ways with more than the specified number of 52 | nodes. Defaults to 1800. Any value below 2 - do not 53 | split. 54 | --saveid=SAVEID Save last ID after execution to a file. 55 | --sql=SQLQUERY SQL query to execute on a PostgreSQL source 56 | 57 | test1: 58 | $ rm -f test1.osm 59 | $ ogr2osm $TESTDIR/shapefiles/test1.shp 60 | running with lxml.etree 61 | Preparing to convert .* (re) 62 | Will try to detect projection from source metadata, or fall back to EPSG:4326 63 | Using default translations 64 | Using default filterLayer 65 | Using default filterFeature 66 | Using default filterTags 67 | Using default filterFeaturePost 68 | Using default preOutputTransform 69 | Parsing data 70 | Detected projection metadata: 71 | PROJCS["NAD_1983_UTM_Zone_10N", 72 | GEOGCS["GCS_NAD83 [CSRS] 4.0.0.BC.1.GVRD_2005-04-05", 73 | DATUM["North_American_Datum_1983", 74 | SPHEROID["GRS_1980",6378137.0,298.257222101]], 75 | PRIMEM["Greenwich",0.0], 76 | UNIT["Degree",0.017453292519943295], 77 | AUTHORITY["EPSG","4269"]], 78 | PROJECTION["Transverse_Mercator"], 79 | PARAMETER["False_Easting",500000.0], 80 | PARAMETER["False_Northing",0.0], 81 | PARAMETER["Central_Meridian",-123.0], 82 | PARAMETER["Scale_Factor",0.9996], 83 | PARAMETER["Latitude_Of_Origin",0.0], 84 | UNIT["Meter",1.0], 85 | AUTHORITY["EPSG","26910"]] 86 | Merging duplicate points in ways 87 | Splitting long ways 88 | Outputting XML 89 | $ xmllint --format test1.osm | diff -uNr - $TESTDIR/test1_py2.xml 90 | 91 | duplicatefile: 92 | $ ogr2osm $TESTDIR/shapefiles/test1.shp 93 | running with lxml.etree 94 | Usage: ogr2osm.py SRCFILE 95 | 96 | SRCFILE can be a file path or a org PostgreSQL connection string such as: 97 | "PG:dbname=pdx_bldgs user=emma host=localhost" (including the quotes) 98 | 99 | ogr2osm.py: error: ERROR: output file .*test1.osm' exists (re) 100 | [2] 101 | 102 | 103 | force: 104 | $ ogr2osm -f $TESTDIR/shapefiles/test1.shp 105 | running with lxml.etree 106 | Preparing to convert .* (re) 107 | Will try to detect projection from source metadata, or fall back to EPSG:4326 108 | Using default translations 109 | Using default filterLayer 110 | Using default filterFeature 111 | Using default filterTags 112 | Using default filterFeaturePost 113 | Using default preOutputTransform 114 | Parsing data 115 | Detected projection metadata: 116 | PROJCS["NAD_1983_UTM_Zone_10N", 117 | GEOGCS["GCS_NAD83 [CSRS] 4.0.0.BC.1.GVRD_2005-04-05", 118 | DATUM["North_American_Datum_1983", 119 | SPHEROID["GRS_1980",6378137.0,298.257222101]], 120 | PRIMEM["Greenwich",0.0], 121 | UNIT["Degree",0.017453292519943295], 122 | AUTHORITY["EPSG","4269"]], 123 | PROJECTION["Transverse_Mercator"], 124 | PARAMETER["False_Easting",500000.0], 125 | PARAMETER["False_Northing",0.0], 126 | PARAMETER["Central_Meridian",-123.0], 127 | PARAMETER["Scale_Factor",0.9996], 128 | PARAMETER["Latitude_Of_Origin",0.0], 129 | UNIT["Meter",1.0], 130 | AUTHORITY["EPSG","26910"]] 131 | Merging duplicate points in ways 132 | Splitting long ways 133 | Outputting XML 134 | $ xmllint --format test1.osm | diff -uNr - $TESTDIR/test1_py2.xml 135 | 136 | nomemorycopy: 137 | $ ogr2osm -f --no-memory-copy $TESTDIR/shapefiles/test1.shp 138 | running with lxml.etree 139 | Preparing to convert .* (re) 140 | Will try to detect projection from source metadata, or fall back to EPSG:4326 141 | Using default translations 142 | Using default filterLayer 143 | Using default filterFeature 144 | Using default filterTags 145 | Using default filterFeaturePost 146 | Using default preOutputTransform 147 | Parsing data 148 | Detected projection metadata: 149 | PROJCS["NAD_1983_UTM_Zone_10N", 150 | GEOGCS["GCS_NAD83 [CSRS] 4.0.0.BC.1.GVRD_2005-04-05", 151 | DATUM["North_American_Datum_1983", 152 | SPHEROID["GRS_1980",6378137.0,298.257222101]], 153 | PRIMEM["Greenwich",0.0], 154 | UNIT["Degree",0.017453292519943295], 155 | AUTHORITY["EPSG","4269"]], 156 | PROJECTION["Transverse_Mercator"], 157 | PARAMETER["False_Easting",500000.0], 158 | PARAMETER["False_Northing",0.0], 159 | PARAMETER["Central_Meridian",-123.0], 160 | PARAMETER["Scale_Factor",0.9996], 161 | PARAMETER["Latitude_Of_Origin",0.0], 162 | UNIT["Meter",1.0], 163 | AUTHORITY["EPSG","26910"]] 164 | Merging duplicate points in ways 165 | Splitting long ways 166 | Outputting XML 167 | $ xmllint --format test1.osm | diff -uNr - $TESTDIR/test1_py2.xml 168 | 169 | positiveid: 170 | $ ogr2osm -f --positive-id $TESTDIR/shapefiles/test1.shp 171 | running with lxml.etree 172 | Preparing to convert .* (re) 173 | Will try to detect projection from source metadata, or fall back to EPSG:4326 174 | Using default translations 175 | Using default filterLayer 176 | Using default filterFeature 177 | Using default filterTags 178 | Using default filterFeaturePost 179 | Using default preOutputTransform 180 | Parsing data 181 | Detected projection metadata: 182 | PROJCS["NAD_1983_UTM_Zone_10N", 183 | GEOGCS["GCS_NAD83 [CSRS] 4.0.0.BC.1.GVRD_2005-04-05", 184 | DATUM["North_American_Datum_1983", 185 | SPHEROID["GRS_1980",6378137.0,298.257222101]], 186 | PRIMEM["Greenwich",0.0], 187 | UNIT["Degree",0.017453292519943295], 188 | AUTHORITY["EPSG","4269"]], 189 | PROJECTION["Transverse_Mercator"], 190 | PARAMETER["False_Easting",500000.0], 191 | PARAMETER["False_Northing",0.0], 192 | PARAMETER["Central_Meridian",-123.0], 193 | PARAMETER["Scale_Factor",0.9996], 194 | PARAMETER["Latitude_Of_Origin",0.0], 195 | UNIT["Meter",1.0], 196 | AUTHORITY["EPSG","26910"]] 197 | Merging duplicate points in ways 198 | Splitting long ways 199 | Outputting XML 200 | $ xmllint --format test1.osm | diff -uNr - $TESTDIR/positiveid_py2.xml 201 | 202 | version: 203 | $ ogr2osm -f --add-version $TESTDIR/shapefiles/test1.shp 204 | running with lxml.etree 205 | Preparing to convert .* (re) 206 | Will try to detect projection from source metadata, or fall back to EPSG:4326 207 | Using default translations 208 | Using default filterLayer 209 | Using default filterFeature 210 | Using default filterTags 211 | Using default filterFeaturePost 212 | Using default preOutputTransform 213 | Parsing data 214 | Detected projection metadata: 215 | PROJCS["NAD_1983_UTM_Zone_10N", 216 | GEOGCS["GCS_NAD83 [CSRS] 4.0.0.BC.1.GVRD_2005-04-05", 217 | DATUM["North_American_Datum_1983", 218 | SPHEROID["GRS_1980",6378137.0,298.257222101]], 219 | PRIMEM["Greenwich",0.0], 220 | UNIT["Degree",0.017453292519943295], 221 | AUTHORITY["EPSG","4269"]], 222 | PROJECTION["Transverse_Mercator"], 223 | PARAMETER["False_Easting",500000.0], 224 | PARAMETER["False_Northing",0.0], 225 | PARAMETER["Central_Meridian",-123.0], 226 | PARAMETER["Scale_Factor",0.9996], 227 | PARAMETER["Latitude_Of_Origin",0.0], 228 | UNIT["Meter",1.0], 229 | AUTHORITY["EPSG","26910"]] 230 | Merging duplicate points in ways 231 | Splitting long ways 232 | Outputting XML 233 | $ xmllint --format test1.osm | diff -uNr - $TESTDIR/version_py2.xml 234 | 235 | timestamp: 236 | $ ogr2osm -f --add-timestamp $TESTDIR/shapefiles/test1.shp 237 | running with lxml.etree 238 | Preparing to convert .* (re) 239 | Will try to detect projection from source metadata, or fall back to EPSG:4326 240 | Using default translations 241 | Using default filterLayer 242 | Using default filterFeature 243 | Using default filterTags 244 | Using default filterFeaturePost 245 | Using default preOutputTransform 246 | Parsing data 247 | Detected projection metadata: 248 | PROJCS["NAD_1983_UTM_Zone_10N", 249 | GEOGCS["GCS_NAD83 [CSRS] 4.0.0.BC.1.GVRD_2005-04-05", 250 | DATUM["North_American_Datum_1983", 251 | SPHEROID["GRS_1980",6378137.0,298.257222101]], 252 | PRIMEM["Greenwich",0.0], 253 | UNIT["Degree",0.017453292519943295], 254 | AUTHORITY["EPSG","4269"]], 255 | PROJECTION["Transverse_Mercator"], 256 | PARAMETER["False_Easting",500000.0], 257 | PARAMETER["False_Northing",0.0], 258 | PARAMETER["Central_Meridian",-123.0], 259 | PARAMETER["Scale_Factor",0.9996], 260 | PARAMETER["Latitude_Of_Origin",0.0], 261 | UNIT["Meter",1.0], 262 | AUTHORITY["EPSG","26910"]] 263 | Merging duplicate points in ways 264 | Splitting long ways 265 | Outputting XML 266 | 267 | utf8: 268 | $ ogr2osm -f $TESTDIR/shapefiles/sp_usinas.shp 269 | running with lxml.etree 270 | Preparing to convert .* (re) 271 | Will try to detect projection from source metadata, or fall back to EPSG:4326 272 | Using default translations 273 | Using default filterLayer 274 | Using default filterFeature 275 | Using default filterTags 276 | Using default filterFeaturePost 277 | Using default preOutputTransform 278 | Parsing data 279 | Detected projection metadata: 280 | GEOGCS["GCS_South_American_1969", 281 | DATUM["South_American_Datum_1969", 282 | SPHEROID["GRS_1967_Modified",6378160.0,298.25]], 283 | PRIMEM["Greenwich",0.0], 284 | UNIT["Degree",0.0174532925199433]] 285 | Merging duplicate points in ways 286 | Splitting long ways 287 | Outputting XML 288 | $ xmllint --format sp_usinas.osm | diff -uNr - $TESTDIR/utf8_py2.xml 289 | 290 | japanese: 291 | $ ogr2osm --encoding shift_jis -f $TESTDIR/shapefiles/japanese.shp 292 | running with lxml.etree 293 | Preparing to convert .* (re) 294 | Will try to detect projection from source metadata, or fall back to EPSG:4326 295 | Using default translations 296 | Using default filterLayer 297 | Using default filterFeature 298 | Using default filterTags 299 | Using default filterFeaturePost 300 | Using default preOutputTransform 301 | Parsing data 302 | No projection metadata, falling back to EPSG:4326 303 | Merging duplicate points in ways 304 | Splitting long ways 305 | Outputting XML 306 | $ xmllint --format japanese.osm | diff -uNr - $TESTDIR/japanese_py2.xml 307 | 308 | duplicatewaynodes: 309 | $ ogr2osm -f $TESTDIR/shapefiles/duplicate-way-nodes.gml 310 | running with lxml.etree 311 | Preparing to convert .* (re) 312 | Will try to detect projection from source metadata, or fall back to EPSG:4326 313 | Using default translations 314 | Using default filterLayer 315 | Using default filterFeature 316 | Using default filterTags 317 | Using default filterFeaturePost 318 | Using default preOutputTransform 319 | Parsing data 320 | No projection metadata, falling back to EPSG:4326 321 | Detected projection metadata: 322 | PROJCS["Amersfoort / RD New", 323 | GEOGCS["Amersfoort", 324 | DATUM["Amersfoort", 325 | SPHEROID["Bessel 1841",6377397.155,299.1528128, 326 | AUTHORITY["EPSG","7004"]], 327 | TOWGS84[565.2369,50.0087,465.658,-0.406857,0.350733,-1.87035,4.0812], 328 | AUTHORITY["EPSG","6289"]], 329 | PRIMEM["Greenwich",0, 330 | AUTHORITY["EPSG","8901"]], 331 | UNIT["degree",0.0174532925199433, 332 | AUTHORITY["EPSG","9122"]], 333 | AXIS["Latitude",NORTH], 334 | AXIS["Longitude",EAST], 335 | AUTHORITY["EPSG","4289"]], 336 | PROJECTION["Oblique_Stereographic"], 337 | PARAMETER["latitude_of_origin",52.15616055555555], 338 | PARAMETER["central_meridian",5.38763888888889], 339 | PARAMETER["scale_factor",0.9999079], 340 | PARAMETER["false_easting",155000], 341 | PARAMETER["false_northing",463000], 342 | UNIT["metre",1, 343 | AUTHORITY["EPSG","9001"]], 344 | AXIS["X",EAST], 345 | AXIS["Y",NORTH], 346 | AUTHORITY["EPSG","28992"]] 347 | unhandled geometry, type: 10 348 | Detected projection metadata: 349 | PROJCS["Amersfoort / RD New", 350 | GEOGCS["Amersfoort", 351 | DATUM["Amersfoort", 352 | SPHEROID["Bessel 1841",6377397.155,299.1528128, 353 | AUTHORITY["EPSG","7004"]], 354 | TOWGS84[565.2369,50.0087,465.658,-0.406857,0.350733,-1.87035,4.0812], 355 | AUTHORITY["EPSG","6289"]], 356 | PRIMEM["Greenwich",0, 357 | AUTHORITY["EPSG","8901"]], 358 | UNIT["degree",0.0174532925199433, 359 | AUTHORITY["EPSG","9122"]], 360 | AXIS["Latitude",NORTH], 361 | AXIS["Longitude",EAST], 362 | AUTHORITY["EPSG","4289"]], 363 | PROJECTION["Oblique_Stereographic"], 364 | PARAMETER["latitude_of_origin",52.15616055555555], 365 | PARAMETER["central_meridian",5.38763888888889], 366 | PARAMETER["scale_factor",0.9999079], 367 | PARAMETER["false_easting",155000], 368 | PARAMETER["false_northing",463000], 369 | UNIT["metre",1, 370 | AUTHORITY["EPSG","9001"]], 371 | AXIS["X",EAST], 372 | AXIS["Y",NORTH], 373 | AUTHORITY["EPSG","28992"]] 374 | Merging duplicate points in ways 375 | Splitting long ways 376 | Outputting XML 377 | $ xmllint --format duplicate-way-nodes.osm | diff -uNr - $TESTDIR/duplicate-way-nodes_py2.xml 378 | 379 | require_output_file_when_using_db_source: 380 | 381 | $ ogr2osm "PG:dbname=test" 382 | running with lxml.etree 383 | Usage: ogr2osm.py SRCFILE 384 | 385 | SRCFILE can be a file path or a org PostgreSQL connection string such as: 386 | "PG:dbname=pdx_bldgs user=emma host=localhost" (including the quotes) 387 | 388 | ogr2osm.py: error: ERROR: An output file must be explicitly specified when using a database source 389 | [2] 390 | 391 | require_db_source_for_sql_query: 392 | 393 | $ ogr2osm $TESTDIR/shapefiles/test1.shp --sql="SELECT * FROM wombats" 394 | running with lxml.etree 395 | Usage: ogr2osm.py SRCFILE 396 | 397 | SRCFILE can be a file path or a org PostgreSQL connection string such as: 398 | "PG:dbname=pdx_bldgs user=emma host=localhost" (including the quotes) 399 | 400 | ogr2osm.py: error: ERROR: You must use a database source when specifying a query with --sql 401 | [2] 402 | -------------------------------------------------------------------------------- /testfiles/duplicate-way-nodes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 863 | -------------------------------------------------------------------------------- /testfiles/duplicate-way-nodes_py2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 863 | -------------------------------------------------------------------------------- /testfiles/shapefiles/duplicate-way-nodes.gml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Schinkelpolder 7 | 2013-02-18 8 | Gemeente Aalsmeer 9 | Viewpoint BV 10 | IMRO2008 11 | 28992 12 | 2500 13 | GISkit PlanKaart IMRO2008 14 | 1.1.0 15 | 16 | 17 | 18 | 19 | NL.IMRO.14 20 | enkelbestemming 21 | Water 22 | water 23 | 10 24 | 25 | 26 | r_NL.IMRO.0358.BPSchinkelpolder-ON01_2.10.html 27 | regels 28 | 29 | 30 | 31 | 32 | WA 33 | 34 | 35 | 36 | 37 | 115064.141 478730.338 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 115007.52 478724.248 115005.717 478723.153 115003.547 478721.78 115001.33 478720.326 114999.08 478718.81 114996.814 478717.252 114994.547 478715.67 114992.295 478714.082 114990.071 478712.508 114987.891 478710.965 114985.768 478709.47 114983.701 478708.029 114981.688 478706.643 114979.724 478705.316 114977.805 478704.048 114975.927 478702.842 114975.498 478702.576 114983.789 478681.398 55 | 56 | 57 | 114983.789 478681.398 114983.787 478680.3 114983.038 478679.497 58 | 59 | 60 | 114983.038 478679.497 114971.878 478674.172 61 | 62 | 63 | 114971.878 478674.172 114971.35 478674.03 114970.806 478674.087 64 | 65 | 66 | 114970.806 478674.087 114963.534 478676.24 67 | 68 | 69 | 114963.534 478676.24 114962.946 478676.573 114962.563 478677.131 70 | 71 | 72 | 114962.563 478677.131 114956.633 478692.279 114955.605 478691.705 114953.284 478690.378 114950.83 478688.95 114948.258 478687.434 114945.584 478685.841 114941.672 478683.496 114925.153 478673.552 114922.152 478671.743 114919.166 478669.941 114916.209 478668.15 114913.29 478666.379 114910.42 478664.631 114907.603 478662.911 114904.841 478661.224 114902.139 478659.575 114899.502 478657.971 114897.608 478656.824 114906.299 478638.327 73 | 74 | 75 | 114906.299 478638.327 114906.369 478637.231 114905.674 478636.381 76 | 77 | 78 | 114905.674 478636.381 114900.861 478633.686 114894.99 478630.399 79 | 80 | 81 | 114894.99 478630.399 114893.842 478630.267 114892.94 478630.991 82 | 83 | 84 | 114892.94 478630.991 114883.379 478648.557 114882.891 478648.291 114880.675 478647.132 114878.455 478646.024 114876.215 478644.966 114873.944 478643.957 114871.647 478643 114869.342 478642.089 114867.044 478641.208 114864.76 478640.345 114862.501 478639.485 114860.275 478638.616 114858.505 478637.893 114859.957 478634.338 85 | 86 | 87 | 114859.957 478634.338 114860.014 478633.372 114859.469 478632.572 88 | 89 | 90 | 114859.469 478632.572 114843.363 478620.475 91 | 92 | 93 | 114843.363 478620.475 114842.9 478619.902 114842.766 478619.178 94 | 95 | 96 | 114842.766 478619.178 114843.673 478605.29 97 | 98 | 99 | 114843.673 478605.29 114843.493 478604.475 114842.906 478603.882 100 | 101 | 102 | 114842.906 478603.882 114839.086 478601.754 103 | 104 | 105 | 114839.086 478601.754 114838.624 478601.589 114838.134 478601.581 106 | 107 | 108 | 114838.134 478601.581 114815.808 478604.916 109 | 110 | 111 | 114815.808 478604.916 114815.423 478604.923 114815.048 478604.832 112 | 113 | 114 | 114815.048 478604.832 114801.977 478599.809 115 | 116 | 117 | 114801.977 478599.809 114799.07 478596.846 114799.402 478592.709 118 | 119 | 120 | 114799.402 478592.709 114814.555 478565.5 121 | 122 | 123 | 114814.555 478565.5 114817.554 478563.124 114821.355 478563.564 124 | 125 | 126 | 114821.355 478563.564 114846.466 478577.539 114912.472 478615.042 114926.727 478623.141 115014.71 478672.935 115034.949 478684.27 115031.153 478691.085 115042.314 478697.304 115063.943 478709.353 115067.699 478702.612 115106.797 478724.509 115145.02 478746.746 115211.213 478783.658 115212.458 478784.361 115252.49 478806.938 115263.366 478813.072 115273.903 478819.015 115276.928 478820.721 115318.251 478844.027 127 | 128 | 129 | 115318.251 478844.027 115319.198 478845.827 115319.249 478847.86 130 | 131 | 132 | 115319.249 478847.86 115319.081 478848.353 115318.981 478848.577 115318.714 478849.016 133 | 134 | 135 | 115318.714 478849.016 115318.052 478849.763 115317.196 478850.276 136 | 137 | 138 | 115317.196 478850.276 115314.768 478850.574 115312.696 478851.876 139 | 140 | 141 | 115312.696 478851.876 115312.47 478852.868 115313.058 478853.697 142 | 143 | 144 | 115313.058 478853.697 115316.978 478855.984 145 | 146 | 147 | 115316.978 478855.984 115317.917 478856.822 115318.137 478858.062 148 | 149 | 150 | 115318.137 478858.062 115316.158 478861.19 151 | 152 | 153 | 115316.158 478861.19 115315.039 478861.57 115313.933 478861.153 154 | 155 | 156 | 115313.933 478861.153 115311.134 478859.523 157 | 158 | 159 | 115311.134 478859.523 115308.985 478859.327 115307.745 478861.094 160 | 161 | 162 | 115307.745 478861.094 115308.119 478864.702 115310.154 478867.705 163 | 164 | 165 | 115310.154 478867.705 115311.224 478869.996 115310.834 478872.495 166 | 167 | 168 | 115310.834 478872.495 115308.202 478877.066 115305.453 478881.568 169 | 170 | 171 | 115305.453 478881.568 115302.823 478883.574 115299.563 478884.137 172 | 173 | 174 | 115299.563 478884.137 115298.237 478884.026 115297.037 478883.455 175 | 176 | 177 | 115297.037 478883.455 115294.514 478881.773 115293.229 478880.859 115291.853 478879.841 115290.398 478878.746 115288.873 478877.601 115287.284 478876.43 115285.638 478875.259 115283.952 478874.12 115282.244 478873.028 115280.524 478871.988 115278.796 478871.003 115277.065 478870.077 115275.338 478869.212 115273.618 478868.412 115271.913 478867.681 115270.242 478867.026 115268.621 478866.441 115267.059 478865.914 115265.56 478865.43 115264.128 478864.978 115262.767 478864.544 115261.663 478864.178 115262.683 478862.426 115272.915 478847.896 178 | 179 | 180 | 115272.915 478847.896 115273.16 478846.74 115272.493 478845.766 181 | 182 | 183 | 115272.493 478845.766 115266.955 478842.253 184 | 185 | 186 | 115266.955 478842.253 115265.889 478842.042 115264.961 478842.606 187 | 188 | 189 | 115264.961 478842.606 115257.995 478851.687 190 | 191 | 192 | 115257.995 478851.687 115257.193 478852.223 115256.231 478852.16 193 | 194 | 195 | 115256.231 478852.16 115249.491 478849.37 196 | 197 | 198 | 115249.491 478849.37 115248.435 478849.336 115247.618 478850.007 199 | 200 | 201 | 115247.618 478850.007 115246.065 478852.703 115245.194 478854.376 115243.726 478853.323 115242.202 478852.281 115240.598 478851.253 115238.925 478850.26 115237.198 478849.309 115235.421 478848.395 115233.592 478847.513 115231.712 478846.655 115229.779 478845.816 115227.793 478844.989 115225.752 478844.169 115223.662 478843.352 115221.53 478842.53 115219.363 478841.696 115217.168 478840.842 115214.949 478839.959 115212.713 478839.04 115210.467 478838.078 115208.214 478837.065 115205.953 478835.992 115203.675 478834.854 115202.435 478834.206 115203.318 478832.611 115211.329 478826.814 202 | 203 | 204 | 115211.329 478826.814 115211.86 478826.107 115211.902 478825.224 205 | 206 | 207 | 115211.902 478825.224 115210.414 478819.453 208 | 209 | 210 | 115210.414 478819.453 115210.126 478818.883 115209.627 478818.484 211 | 212 | 213 | 115209.627 478818.484 115195.077 478811.272 115191.24 478809.371 214 | 215 | 216 | 115191.24 478809.371 115190.186 478809.265 115189.326 478809.883 217 | 218 | 219 | 115189.326 478809.883 115181.533 478821.577 115179.727 478820.398 115177.176 478818.74 115174.592 478817.079 115171.972 478815.424 115169.316 478813.788 115166.633 478812.183 115163.936 478810.616 115161.235 478809.086 115158.539 478807.592 115155.857 478806.133 115153.196 478804.709 115150.566 478803.319 115147.974 478801.962 115145.427 478800.636 115142.924 478799.338 115140.462 478798.065 115138.042 478796.815 115135.662 478795.583 115133.32 478794.368 115131.016 478793.165 115128.749 478791.973 115126.52 478790.789 115124.325 478789.607 115122.16 478788.417 115120.02 478787.213 115117.899 478785.986 115115.793 478784.727 115113.695 478783.429 115111.597 478782.08 115109.481 478780.668 115107.329 478779.192 115105.902 478778.198 115113.335 478763.515 220 | 221 | 222 | 115113.335 478763.515 115113.468 478762.542 115112.971 478761.696 223 | 224 | 225 | 115112.971 478761.696 115093.906 478745.432 226 | 227 | 228 | 115093.906 478745.432 115093.533 478745.199 115093.108 478745.084 229 | 230 | 231 | 115093.108 478745.084 115076.992 478743.186 232 | 233 | 234 | 115076.992 478743.186 115076.14 478743.337 115075.513 478743.933 235 | 236 | 237 | 115075.513 478743.933 115068.682 478755.921 115065.782 478754.42 115062.432 478752.694 115059.066 478750.969 115055.71 478749.254 115052.392 478747.562 115049.137 478745.904 115045.972 478744.292 115042.923 478742.738 115040.009 478741.249 115037.224 478739.823 115034.556 478738.456 115031.994 478737.142 115029.527 478735.877 115027.143 478734.655 115024.831 478733.473 115022.58 478732.326 115020.385 478731.21 115018.241 478730.115 115016.136 478729.028 115014.057 478727.932 115011.99 478726.812 115009.921 478725.654 115007.836 478724.44 115007.52 478724.248 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | NL.IMRO.0358.BPSchinkelpolder-ON01 254 | bestemmingsplan 255 | gemeentelijke overheid 256 | Gemeente Aalsmeer 257 | 0358 258 | Schinkelpolder 259 | Schinkelpolder 260 | 261 | 262 | ontwerp 263 | 2013-02-11 264 | 265 | 266 | 267 | 268 | rb_NL.IMRO.0358.BPSchinkelpolder-ON01_index.html 269 | bijlage bij regels 270 | 271 | 272 | 273 | 274 | r_NL.IMRO.0358.BPSchinkelpolder-ON01_index.html 275 | regels 276 | 277 | 278 | 279 | 280 | t_NL.IMRO.0358.BPSchinkelpolder-ON01_index.pdf 281 | toelichting 282 | 283 | 284 | o_NL.IMRO.0823.BPBGfase12010-VG02.dxf 285 | IMRO2008 286 | PRBP2008 287 | 288 | 289 | 290 | 291 | 292 | 293 | 115582.685 479885.268 115582.714 479878.301 115581.476 479877.892 115492.865 479831.756 115399.638 479781.248 115350.098 479752.498 115282.584 479715.242 115256.179 479700.444 115236.621 479689.88 115231.863 479687.708 115228.07 479685.694 115224.92 479683.524 115221.902 479681.735 115220.621 479681.059 115219.629 479680.533 115216.668 479678.96 115212.66 479676.749 115207.496 479674.483 115205.915 479673.529 115204.25 479671.972 115202.715 479670.44 115201.424 479669.294 115199.875 479668.454 115175.007 479652.008 115124.867 479616.629 115100.582 479599.333 115074.598 479580.677 115051.19 479564.485 115024.615 479545.524 114996.387 479525.853 114972.858 479509.146 114971.237 479505.807 114961.821 479498.833 114956.901 479497.081 114913.602 479466.695 114903.684 479458.667 114901.602 479456.705 114898.342 479454.768 114895.856 479453.143 114871.839 479436.467 114860.173 479426.918 114844.955 479412.866 114828.986 479397.831 114821.82 479390.35 114807.194 479375.53 114787.234 479353.618 114741.496 479303.109 114727.847 479288.227 114720.404 479279.265 114709.661 479265.692 114678.256 479233.174 114671.946 479226.439 114667.74 479221.646 114664.187 479217.47 114660.821 479213.394 114657.569 479209.248 114654.061 479204.583 114650.727 479199.627 114647.591 479194.689 114644.979 479189.662 114642.589 479184.779 114640.304 479179.068 114637.861 479171.165 114633.913 479156.706 114621.181 479095.401 114609.076 479033.954 114601.225 479000 114597.257 478982.836 114582.723 478920.769 114579.86 478909.252 114578.647 478902.772 114577.692 478898.624 114576.912 478894.262 114576.443 478890.546 114576.281 478886.136 114576.702 478881.702 114577.12 478877.942 114577.466 478876.624 114578.128 478874.095 114579.639 478869.385 114581.3 478865.395 114583.758 478860.721 114603.875 478822.458 114603.994 478822.101 114604.636 478820.572 114604.973 478820.71 114607.509 478815.991 114607.073 478815.79 114607.784 478814.246 114608.189 478814.433 114620.155 478792.688 114643.944 478748.656 114667.176 478706.561 114691.336 478662.036 114731.705 478589.32 114741.225 478572.653 114742.931 478569.421 114743.678 478567.207 114744.111 478564.044 114743.756 478561.852 114742.901 478559.518 114742.508 478558.685 114741.48 478556.504 114741.059 478556.704 114740.638 478556.146 114738.736 478553.359 114736.22 478550.48 114732.998 478547.11 114730.876 478544.733 114728.481 478541.691 114725.545 478539.057 114725.26 478538.801 114722.051 478536.701 114694.53 478521.601 114641.712 478493.953 114602.152 478473.313 114595.17 478469.67 114594.728 478470.45 114586.292 478465.785 114582.863 478463.976 114580.554 478462.729 114573.898 478459.191 114569.428 478456.276 114565.899 478453.52 114562.94 478450.399 114560.908 478446.975 114559.571 478443.039 114559.207 478439.2 114559.961 478433.901 114561.774 478429.335 114564.063 478425.408 114566.849 478421.188 114569.876 478417.609 114573.293 478414.568 114576.201 478411.987 114578.983 478408.99 114580.919 478406.243 114587.859 478393.493 114591.366 478382.848 114594.873 478372.202 114598.651 478359.903 114604.422 478349.316 114620.5 478320.795 114633.786 478297.402 114646.029 478276.23 114652.373 478264.099 114655.758 478257.126 114658.103 478252.097 114660.053 478247.553 114663.398 478239.815 114665.821 478234.391 114667.271 478229.48 114668.078 478227.002 114669.141 478224.502 114669.769 478223.321 114670.396 478222.139 114671.691 478220.05 114673.009 478218.181 114674.373 478216.477 114674.996 478215.886 114676.757 478214.376 114679.358 478212.94 114683.084 478211.185 114692.821 478207.383 114696.167 478205.934 114698.234 478204.976 114700.271 478203.909 114701.934 478202.694 114702.698 478202.01 114703.461 478201.326 114705.747 478198.693 114711.191 478191.442 114712.204 478189.52 114713.217 478187.597 114713.638 478186.532 114713.821 478185.852 114713.782 478185.233 114713.519 478184.747 114712.937 478184.098 114736.322 478142.367 114739.706 478136.33 114747.162 478123.024 114784.267 478053.625 114809.772 478007.352 114818.943 477991.424 114829.09 477973.217 114846.149 477942.505 114864.564 477908.891 114880.734 477878.82 114916.488 477813.693 114928.842 477791.651 114942.488 477767.505 114956.93 477741.519 114958.782 477737.457 114959.852 477733.478 114961.907 477729.028 114966.549 477718.311 114979.103 477693.092 114980.403 477690.083 114984.309 477681.047 114993.375 477661.714 114998.938 477664.737 114999.902 477664.695 115000 477664.691 115008.438 477664.328 115015.711 477664.946 115016.614 477663.269 115023.789 477667.211 115030.851 477653.959 115034.199 477647.534 115047.011 477623.374 115047.857 477621.78 115078.831 477648.303 115091.594 477655.002 115092.204 477655.093 115097.486 477657.867 115101.453 477659.997 115104.96 477661.88 115107.914 477663.146 115110.841 477664.574 115113.69 477666.106 115116.835 477667.398 115117.812 477667.799 115120.046 477668.718 115123.053 477670.314 115124.293 477670.973 115124.723 477671.201 115126.854 477672.332 115130.974 477674.785 115136.139 477678.047 115137.486 477675.672 115140.759 477677.718 115142.343 477678.576 115156.257 477686.241 115154.918 477688.338 115156.152 477689.027 115157.455 477689.754 115157.479 477689.768 115164.931 477694.268 115171.46 477698.086 115171.483 477698.099 115185.891 477706.192 115199.34 477713.747 115204.811 477716.82 115218.246 477724.105 115227.39 477729.063 115249.61 477741.112 115251.457 477742.125 115252.571 477743.017 115253.58 477743.826 115264.426 477748.652 115272.021 477751.145 115293.661 477758.248 115307.875 477763.236 115309.552 477763.83 115320.816 477767.821 115334.42 477772.641 115354.415 477779.727 115378.05 477788.101 115384.348 477792.166 115409.34 477808.517 115412.321 477810.863 115421.124 477815.06 115425.525 477818.701 115432.553 477822.553 115432.722 477822.646 115434.698 477823.729 115435.528 477824.169 115440.038 477826.564 115462.859 477840.209 115463.522 477840.617 115476.137 477848.835 115485.519 477854.947 115496.673 477862.214 115502.144 477865.283 115511.948 477870.783 115521.945 477876.614 115527.522 477881.112 115530.711 477882.515 115532.548 477883.323 115532.614 477883.367 115547.452 477893.291 115554.71 477897.269 115580.028 477912.75 115581.588 477914.744 115613.077 477933.252 115614.587 477934.14 115656.752 477955.242 115674.56 477965.539 115691.206 477975.164 115697.537 477978.825 115698.135 477979.249 115699.067 477979.71 115697.81 477981.94 115714.85 477991.302 115729.492 477999.347 115730.499 478000 115738.925 478005.466 115742.739 478007.562 115744.466 478008.511 115750.007 478011.294 115754.679 478013.692 115760.504 478017.092 115765.92 478020.252 115772.315 478023.983 115773.126 478024.457 115776.302 478027.71 115777.76 478028.486 115801.944 478041.359 115817.981 478050.004 115820.955 478051.608 115821.788 478052.027 115834.29 478058.278 115836.412 478059.378 115836.68 478059.517 115846.264 478065.094 115848.563 478066.323 115861.539 478073.26 115861.973 478072.515 115878.989 478081.606 115881.182 478082.778 115882.389 478083.464 115889.904 478087.732 115889.974 478087.766 115901.418 478093.295 115910.783 478097.82 115926.324 478105.329 115946.345 478115.002 115958.415 478121.253 115961.207 478122.699 115962.289 478120.883 115970.47 478125.141 115974.521 478130.689 115977.461 478135.209 116000 478169.862 116002.723 478174.048 116012.257 478187.732 116013.024 478189.813 116012.345 478192.517 116009.981 478197.258 116067.379 478227.65 116158.892 478281.042 116165.656 478280.231 116167.648 478280.668 116173.365 478281.341 116175.675 478281.779 116187.692 478282.809 116193.495 478283.327 116196.086 478283.572 116199.127 478283.632 116207.731 478283.539 116213.508 478283.476 116218.502 478284.096 116221.854 478287.53 116227.155 478292.962 116229.885 478298.37 116231.112 478300.06 116236.341 478307.141 116237.646 478309.066 116239.123 478312.645 116243.736 478318.69 116240.295 478325.124 116246.339 478328.327 116249.057 478329.602 116254.841 478332.258 116258.317 478334.738 116330.188 478373.362 116341.042 478379.195 116427.692 478370.21 116462.183 478386.304 116459.674 478393.525 116456.401 478418.134 116456.164 478421.449 116454.791 478427.238 116453.606 478430.037 116451.677 478433.737 116449.064 478438.223 116445.449 478443.998 116449.286 478446.237 116437.995 478456.623 116434.446 478458.724 116427.81 478458.303 116422.126 478467.808 116410.588 478482.281 116400.35 478493.982 116396.328 478500 116372.616 478535.482 116369.516 478533.905 116307.661 478635.954 116191.004 478841.288 116120.769 478965.256 116101.107 479000 116034.864 479117.054 116000 479178.296 115985.814 479203.215 115888.719 479374.309 115817.548 479499.863 115817.47 479500 115785.41 479556.461 115733.36 479647.444 115730.198 479655.185 115724.671 479671.969 115719.847 479694.998 115715.634 479715.79 115711.794 479735.777 115706.133 479777.864 115704.768 479781.677 115696.974 479799.78 115687.196 479820.035 115675.533 479840.84 115663.525 479859.908 115661.562 479862.636 115625.241 479913.18 115624.866 479912.775 115619.018 479907.633 115615.972 479905.182 115613.376 479903.094 115610.569 479900.43 115607.143 479898.933 115602.084 479895.476 115595.491 479891.628 115582.685 479885.268 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | -------------------------------------------------------------------------------- /testfiles/shapefiles/japanese.dbf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnorman/ogr2osm/a20f3310c9e81c8231f3c2109cb93db9adc72931/testfiles/shapefiles/japanese.dbf -------------------------------------------------------------------------------- /testfiles/shapefiles/japanese.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnorman/ogr2osm/a20f3310c9e81c8231f3c2109cb93db9adc72931/testfiles/shapefiles/japanese.shp -------------------------------------------------------------------------------- /testfiles/shapefiles/japanese.shx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnorman/ogr2osm/a20f3310c9e81c8231f3c2109cb93db9adc72931/testfiles/shapefiles/japanese.shx -------------------------------------------------------------------------------- /testfiles/shapefiles/sp_usinas.dbf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnorman/ogr2osm/a20f3310c9e81c8231f3c2109cb93db9adc72931/testfiles/shapefiles/sp_usinas.dbf -------------------------------------------------------------------------------- /testfiles/shapefiles/sp_usinas.prj: -------------------------------------------------------------------------------- 1 | GEOGCS["GCS_South_American_1969",DATUM["D_South_American_1969",SPHEROID["GRS_1967_Truncated",6378160.0,298.25]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]] -------------------------------------------------------------------------------- /testfiles/shapefiles/sp_usinas.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnorman/ogr2osm/a20f3310c9e81c8231f3c2109cb93db9adc72931/testfiles/shapefiles/sp_usinas.shp -------------------------------------------------------------------------------- /testfiles/shapefiles/sp_usinas.shx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnorman/ogr2osm/a20f3310c9e81c8231f3c2109cb93db9adc72931/testfiles/shapefiles/sp_usinas.shx -------------------------------------------------------------------------------- /testfiles/shapefiles/test1.dbf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnorman/ogr2osm/a20f3310c9e81c8231f3c2109cb93db9adc72931/testfiles/shapefiles/test1.dbf -------------------------------------------------------------------------------- /testfiles/shapefiles/test1.prj: -------------------------------------------------------------------------------- 1 | PROJCS["NAD_1983_UTM_Zone_10N",GEOGCS["GCS_NAD83 [CSRS] 4.0.0.BC.1.GVRD_2005-04-05",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-123.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]] -------------------------------------------------------------------------------- /testfiles/shapefiles/test1.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnorman/ogr2osm/a20f3310c9e81c8231f3c2109cb93db9adc72931/testfiles/shapefiles/test1.shp -------------------------------------------------------------------------------- /testfiles/shapefiles/test1.shx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnorman/ogr2osm/a20f3310c9e81c8231f3c2109cb93db9adc72931/testfiles/shapefiles/test1.shx --------------------------------------------------------------------------------