Following a post about the emerging Berlin skyline a number of other views of cities ( London , Historical New York ) have been put online using the fantastic OSM Buildings tool.
I have wanted to enable better views of Glasgow and the current construction and planning. There is an existing Urban Model which is kept in a proprietary and licensed format. It would be ideal if under the banner of the Open Data initiative this was released either directly to the Open Street Map project or via api as has been done in cities like New York .
My contribution is this interactive map , showing planned, recently constructed and some speculative models that i could find.There is a tutorial to add buildings or play with ideas.
( NB just leaving these links to what other cities who have real open data policies can do . Data should "Default To Open" )
As is the nature of these planned buildings visualisation in context is not generally available. To this end i have been trying to make the model creation easier. It would be an interesting step forward if architects submitted obj or GeoJSON models as part of the planning process.
Luckily as part of the process site layouts are submitted. Usually very helpfully in pdf format.
Importing into Inkscape gives you this;
Buildings and any other features of interest can be separated and cleaned up.Repositioning to make the GIS translations simpler is trivial with align tools.
Export to DXF and making use of the GDAL tools, and ogr2ogr in particular, generate an appropriate file.
I "gently coerce" the output file GeoJSON to the correct polygon format and add some data needed by OSMBuildings.
This is then read into geojson.io to allow further editing and referencing to use in display.NB A polygon, rather than just point, move would be a big help in geojson.io
HELP !
Here is where my lack of proper GIS knowledge shows, there is a choice of coordinate system that i am missing or not choosing correctly. The model is shearing in the transform as i try to geolocate the model. I need a simple translate in a normal cartesian rectangular frame, so unfortunately the model is distorted just now. This should be an easy fix for someone who knows what they are doing.
Here is what i am currently doing, the srs coord frames are what needs changing, or something in the sql needs to specify a coord frame; ( geojson.io needs WGS84 )
ogr2ogr -f "GeoJSON" -overwrite "$oFileName".geojson -s_srs EPSG:4326 -t_srs EPSG:4326 "$bname".shp -dialect sqlite( edited to change srs to 4326 )
-sql "SELECT ShiftCoords(ScaleCoords(ShiftCoords( geometry,-X(Centroid(GEOMETRY)),
-Y(Centroid(GEOMETRY))),$scale),$long+(X(Centroid(GEOMETRY))*$scale),$lat+(Y(Centroid(GEOMETRY))*$scale)) FROM $bname"
NB if i leave centred at 0,0 the images are straight and right angled so it is the shiftCoords and/or the srs coord frames not the other manipulations that are doing the shear. Could it just be rounding/precision issue ?
ie
Linking the geojson model in to the Glasgow model gives this;
A good step forward but not the complete tool by any means. Too many workarounds , it may actually be easier to rework the openSCAD export extension in Inkscape but that would then limit use to only inkscape users. Fixes in gdal 2.0+ make the polygon creation simpler. A better way to calculate rescale value and specifying the geolocate origin as well
No comments:
Post a Comment