UserAndre Castro/maps01: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
 
(24 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=Maps=
==<span style="background:black; color:white">Street Name Map in</span> http://pzwart3.wdka.hro.nl/~acastro/map/==


As is possible to render retrieved data from osm api and then render that data into a static map in svg format, that started to resonate with the work we have been developing with Michael concerning svgs and a drew possibilities for different lines of action.
 
==Presentation Notes==
 
===What is it (at the moment)===
* A map of the center of Rotterdam
* peculiarity: drawn solely by its streets names
* street names suffixes (straat, weg, etc) remove
* can access information on the person, local or event which names the street
 
 
===Aims===
* Intention is still not clear
* Developed from my fascination with maps, specially maps that are border-less
* A way to look at the city and try to understand a more of it
** What names are given to streets?
** Who are this people?
** the shapes it draws - (Michel de Certeau - city and view; walking)
 
* not finished
* what i want it to be ? not sure
* one experiment: overlay map of Rotterdam before destroyed in WWII
* perhaps: the 2 overplayed maps can serve as an invitation to walk on the routes of the old medival city, using the current city as the interface
 
===Process===
* OpenStreeMap - possibility that it gives to make request on the map's data of an area
* Osmarender - rendering tool - according to rules render the data into an svg image
* Posting request on the street names and scraping info from Rotterdam municipality streets'name archive
* Displaying under html document
 
 
===Resources===
* OpenStreetMap: http://www.openstreetmap.org/
* Osmarender: http://wiki.openstreetmap.org/wiki/Osmarender
* Street names information: http://www.gemeentearchief.rotterdam.nl/collectie/straatnamen
 
 
 
 
 
 
 
 
----
 
==Process==
 
===Maps / osm intro===
Having recently found out [http://www.openstreetmap.org/ Open Street Map] I have been finding its  various possibilities. Not only it is a open-source project that allows users to search and find information about place, but also anyone can contribute to the improvement of the maps, and the can easily be retrieved and used, for example to create new maps.
 
 
I have been exploring its potential and aiming at creating non-functional maps or trajectories that could open new perspectives on the city space. (situationists echos)
   


===New Maps===
===New Maps===
Thinking about my fascination with maps, specially unconventional maps in which accuracy and compreenshion are not priorities, such as map that friend draws you on a napkin, I started to image what this map could be, what form it could take, what would be its purpose, how it would be displayed and navigated.


Seeing in [http://makingmaps.net/2011/01/31/word-maps-words-on-maps-map-typography/ blog] a map of South America in which a mistake prevented the map-lines from being printed. The fluidity and bordeless of the map said me something about mobility and loosening of geo-policital constraints. [[File:Map-SouthAmerica.jpg|thumb]]  
Thinking about my fascination with maps, specially unconventional maps in which accuracy and comprehension are not priorities, such as map that friend draws you on a napkin, I started to imagine what this map could be, what form could it take, what would be its purpose, how it would be displayed and navigated.
 
Seeing in [http://makingmaps.net/2011/01/31/word-maps-words-on-maps-map-typography/ Making Maps blog] a map of South America in which a mistake prevented the map-lines from being printed. The fluidity and in nonexistence of border said something about mobility and loosening of geo-political constraints. [[File:Map-SouthAmerica.jpg|thumb]]  


I would be great to do a similar thing to a city. What happens when your only referrences are the street names? Does our vision of it changes? Can we still navigate through it? Will it still be possible to go from place A to place B taking this map as a reference?
I would be interesting to do a similar thing to a city map. What happens when your the only references are the street names? Does our vision of the city change? Will it still be possible to go from place A to place B taking the map as a reference?


This possibility also made sense with a simple idea I had been tinkering with of removing the stree name's suffixes. So in Rotterdam "Nieuwe Binnenweg" will become only "Nieuwe Binnen".   
This possibility also seemed to make sense with a simple idea I had been tinkering with of removing the street-name's suffixes. So in Rotterdam "Nieuwe Binnenweg" will be only represented as "Nieuwe Binnen".   


So I went on doing so.     
So I went on doing so.     
    
    


===retriving osm data===
====retrieving osm data====
...
===data manipulation===
...
* [xml-manipulation-code]


===data rendering to svg osmarender===
* find coordinates
osmararender renders osm data into an svg.
In [http://www.openstreetmap.org/ openstreetmap.org] go to Export Menu and check the coordinates. they organized as [lat,long, lat++, long++] area[1,3,2,0] or in other works [lat,long, lat++, long++]
It is constituted of 2 files...
- ...features.xml - one is supposed to edit, to change the apperance of the map
- osmarender - instructs on how the rendering should be done, and is advised not to chnage it.


I have started by altering the features file, so for example: I remove all the elements besides thes the street names, or live only the lines an street names
* wget that area's data
<source lang="bash">
wget -O data.osm "http://api.openstreetmap.org/api/0.6/map?bbox=4.4552603823670465,51.91739525301985,4.46384345121436,51.920373035178464"
</source>


However when rendering the svg becomes filled with elements which are not present, therefore making it heavy and dificult to go through




====Manipulation Data====


===Manipulating the Map===
[[UserAndre Castro/maps01/xmlManipulate | python code]]
<span style:"background-color=yellow">put text here. Leave code to the other page</span>


====features file====
* removing the '//area|//circle|//symbol|//caption'
* removing also line | wayMarker tags will produce words-maps 


* changed svgBaseProfie="basic (tinny)
====data rendering to svg osmarender====


* background remove - in the svg the tag rect
[http://wiki.openstreetmap.org/wiki/Osmarender Osmararender] renders osm data into an svg.
<id="background" x="0px" y="0px" height="72.8048679813291px" width="128.000000000004px" class="map-background"/>
It is constituted of 2 files:
if removed we take way the backgorund :)


* borderless
- osm-map-features-z17.xml - is a kind of preferences file. Has to be edited in order to change the appearance of the map


- osmarender.xls - instructs on how the rendering should be done. Is advised not to change it.
I have started by altering the features file. For example: I remove all the elements besides the street names, or leave only lines and street names
<span style="background-color:yellow">(Not sure yet)</span> It seems that when rendering, the svg becomes filled with elements which are no longer present (removed in the features-z17.xml file, therefore making it heavy and dificult to go through
Next step it to apply XSLT stylesheets to XML documents using xsltproc
using xmlstartlet
xmlstarlet tr osmarender.xsl osm-map-features-z17.xml > map.svg
using xmltproc
xsltproc osm-map-features-z17.xml > rendered-map.svg
Note: data file should be called data.osm, or otherwise osm-map-features-z17.xml data="data.osm" should be changed to the name to the file name in which is in 
tanttttaaaaaa! the map (svg exported to svg)
[[File: render-exp-04.png|thumb]]
====Map Appearance====
My aim is to render only the street names. This is are the steps to do it
* pyton script (xpath) to parse the '''rules file''', removing from the rules for unwanted visual elements. In this case all will be all besides the street's name
[[UserAndre Castro/maps01/features_change | changing features file - python code ]]
 
* changed the svgBaseProfile.This can be set to full, basic of tinny(optimized to mobile phones) svgBaseProfie="basic"
* remove background - in the svg the tag rect
In order to to so I had to edit the osmarender.xsl file and commented the background background
<source lang="xml"> <!-- <rect id="background" x="0px" y="0px" height="{$documentHeight}px" width="{$documentWidth}px" class="map-background"/> --> </source> 
*frame removal
by altering the <b>features file</b> both minimumMapWidth="0.5" minimumMapHeight="0.5" to 1.5


====osmarender xsl file====
====osmarender xsl file====
Currently I am lookingon how to change to osmarander.xsl file so just the elements that are wanted are rendered into the svg. However muhc work needs to be donde here.
Currently I am looking more into how to change to osmarander.xsl file, so that just the elements that are wanted are rendered into the svg.  
<span style="background-color:yellow"> Much work to do here


* parsing  
* parsing  
x = lxml.etree.XSLT(doc)
x = lxml.etree.XSLT(doc)
http://lxml.de/xpathxslt.html#xslt
http://lxml.de/xpathxslt.html#xslt
</span>




* (To Do: simplify ways - these seem to be made of several layers of unecessary grey )
==Resources==


* To Do: remove background
http://www.use-it.be/europe/docs/OSMmanual/


http://wiki.openstreetmap.org/wiki/Osmarender


http://wiki.openstreetmap.org/wiki/Getting_Data Getting Data


==============
The rule file is an xml file that specifies the drawing rules.
Its basic structure is a list of selection rules containing rendering instructions that are processed sequentially


Each rule specifies what elements to select based on a matching key/value pair (for example, e="way" k="highway" v="motorway" will select all ways that have a highway tag with a value of motorway). It then specifies what to do with these nodes or segments or ways.
==Other Possibilities==


* GPS traces
* Topographic map








---
===relevant links===


I have recently found open street maps. Not only it is a open-source project that allows users to search and find place, but also anyone to contribute for the improvement of the maps, and it allowing geographical data to be easily retrieved.
http://derickrethans.nl/what-is-openstreetmap.html Good explanation of OSM project  


http://weait.com/content/openstreetmap-planet-file


I would explore its potential to create non-functional maps or trajectories that could open new perspectives on the city space. (situationists echos)
http://derickrethans.nl/spatial-indexes-data-sqlite.html
   


==Map Making using Open Street Map ==
[http://wiki.openstreetmap.org/wiki/Frameworks osm Frameworks]


* installed osmarender
[http://wiki.openstreetmap.org/wiki/Deploying_your_own_Slippy_Map Deploying your own Slippy Map]


[http://wiki.openstreetmap.org/wiki/Pyrender Pyrender-map rendering framework, programmed in Python]


===ask for the geographical data===
[http://wiki.openstreetmap.org/wiki/PythonOsmApi PythonOsmApi]


* find coordinates
In [http://www.openstreetmap.org/ openstreetmap.org] go to Export Menu and check the coordinates. they organized as [lat,long, lat++, long++] area[1,3,2,0] or in other works [lat,long, lat++, long++]


====Databases and data acess APIs====


* wget that area's data
http://wiki.openstreetmap.org/wiki/Databases_and_data_access_APIs
<source lang="bash">
wget -O data.osm "http://api.openstreetmap.org/api/0.6/map?bbox=4.4552603823670465,51.91739525301985,4.46384345121436,51.920373035178464"
</source>




* <b>[[UserAndre Castro/maps01/xmlManipulate | XML data manipulation]]</b>
====xpath tutorials====


http://infohost.nmt.edu/tcc/help/pubs/pylxml/web/index.html#intro


===render the data into an svg===
http://www.w3schools.com/xpath/default.asp


* mv this data.osm file into the same the osmarender dir
http://lxml.de/


* call osmarender to process the data.osm into a rendered svg image


** osm-map-features-z17.xml tells what to put on the map - <span style="background-color:yellow">CAN BE EDITED</span> in order to change the result
** osmarender.xsl a stylesheet that directs the actual rendering work - DON'T MESS WITH IT!
** xsltproc applies XSLT stylesheets to XML documents.


<source lang="bash">
xsltproc osm-map-features-z17.xml > rendered-map.svg
</source>


tanttttaaaaaa! the map (svg exported to svg)


[[File: render-exp-04.png]]
---


===<span style="background-color:yellow">data filtering</span>===


[http://wiki.openstreetmap.org/wiki/Osmfilter osmfilter] can also be used to include or exclude certain map data






* Info sources:


http://www.use-it.be/europe/docs/OSMmanual/


http://wiki.openstreetmap.org/wiki/Osmarender


[http://wiki.openstreetmap.org/wiki/Getting_Data Getting Data]


==Other Possibilities==


* GPS traces
* Topographic map


==OLD==




==OSM Elements==
===OSM Elements===
source: http://wiki.openstreetmap.org/wiki/Map_Features
source: http://wiki.openstreetmap.org/wiki/Map_Features


Line 156: Line 224:




==Databases and data acess APIs==
===Databases and data acess APIs===
http://wiki.openstreetmap.org/wiki/Databases_and_data_access_APIs  
http://wiki.openstreetmap.org/wiki/Databases_and_data_access_APIs  


===API===
====API====
The main API is the method of obtaining OSM data used by editors. Its limitations are that it will only return very small areas <0.25deg square.
The main API is the method of obtaining OSM data used by editors. Its limitations are that it will only return very small areas <0.25deg square.


Line 166: Line 234:
===TRAPI====
===TRAPI====


===XAPI - Retrieve Particular Data Request <span style="background-color:red">Needs to be edited</span>===
===XAPI====
- Retrieve Particular Data Request <span style="background-color:red">Needs to be edited</span>===


To acess data of a given area in http://www.openstreetmap.org/ go to Export Menu and check the coordinates. they organized as [bbox=lat,long, lat++, long++] area[1,3,2,0] or in other works [lat,long, lat++, long++]  
To acess data of a given area in http://www.openstreetmap.org/ go to Export Menu and check the coordinates. they organized as [bbox=lat,long, lat++, long++] area[1,3,2,0] or in other works [lat,long, lat++, long++]  
Line 223: Line 292:


Source: http://wiki.openstreetmap.org/wiki/Xapi
Source: http://wiki.openstreetmap.org/wiki/Xapi
===relevant links===
http://derickrethans.nl/what-is-openstreetmap.html Good explanation of OSM project
http://weait.com/content/openstreetmap-planet-file
http://derickrethans.nl/spatial-indexes-data-sqlite.html
[http://wiki.openstreetmap.org/wiki/Frameworks osm Frameworks]
[http://wiki.openstreetmap.org/wiki/Deploying_your_own_Slippy_Map Deploying your own Slippy Map]
[http://wiki.openstreetmap.org/wiki/Pyrender Pyrender-map rendering framework, programmed in Python]
[http://wiki.openstreetmap.org/wiki/Osmfilter Osmfilter]
[http://wiki.openstreetmap.org/wiki/PythonOsmApi PythonOsmApi]
====Databases and data acess APIs====
http://wiki.openstreetmap.org/wiki/Databases_and_data_access_APIs
===xpath tutorials===
http://infohost.nmt.edu/tcc/help/pubs/pylxml/web/index.html#intro
http://www.w3schools.com/xpath/default.asp
http://lxml.de/

Latest revision as of 17:06, 10 January 2013

Street Name Map in http://pzwart3.wdka.hro.nl/~acastro/map/

Presentation Notes

What is it (at the moment)

  • A map of the center of Rotterdam
  • peculiarity: drawn solely by its streets names
  • street names suffixes (straat, weg, etc) remove
  • can access information on the person, local or event which names the street


Aims

  • Intention is still not clear
  • Developed from my fascination with maps, specially maps that are border-less
  • A way to look at the city and try to understand a more of it
    • What names are given to streets?
    • Who are this people?
    • the shapes it draws - (Michel de Certeau - city and view; walking)
  • not finished
  • what i want it to be ? not sure
  • one experiment: overlay map of Rotterdam before destroyed in WWII
  • perhaps: the 2 overplayed maps can serve as an invitation to walk on the routes of the old medival city, using the current city as the interface

Process

  • OpenStreeMap - possibility that it gives to make request on the map's data of an area
  • Osmarender - rendering tool - according to rules render the data into an svg image
  • Posting request on the street names and scraping info from Rotterdam municipality streets'name archive
  • Displaying under html document


Resources






Process

Maps / osm intro

Having recently found out Open Street Map I have been finding its various possibilities. Not only it is a open-source project that allows users to search and find information about place, but also anyone can contribute to the improvement of the maps, and the can easily be retrieved and used, for example to create new maps.


I have been exploring its potential and aiming at creating non-functional maps or trajectories that could open new perspectives on the city space. (situationists echos)


New Maps

Thinking about my fascination with maps, specially unconventional maps in which accuracy and comprehension are not priorities, such as map that friend draws you on a napkin, I started to imagine what this map could be, what form could it take, what would be its purpose, how it would be displayed and navigated.

Seeing in Making Maps blog a map of South America in which a mistake prevented the map-lines from being printed. The fluidity and in nonexistence of border said something about mobility and loosening of geo-political constraints.

Map-SouthAmerica.jpg

I would be interesting to do a similar thing to a city map. What happens when your the only references are the street names? Does our vision of the city change? Will it still be possible to go from place A to place B taking the map as a reference?

This possibility also seemed to make sense with a simple idea I had been tinkering with of removing the street-name's suffixes. So in Rotterdam "Nieuwe Binnenweg" will be only represented as "Nieuwe Binnen".

So I went on doing so.


retrieving osm data

  • find coordinates

In openstreetmap.org go to Export Menu and check the coordinates. they organized as [lat,long, lat++, long++] area[1,3,2,0] or in other works [lat,long, lat++, long++]

  • wget that area's data
wget -O data.osm "http://api.openstreetmap.org/api/0.6/map?bbox=4.4552603823670465,51.91739525301985,4.46384345121436,51.920373035178464"


Manipulation Data

python code put text here. Leave code to the other page


data rendering to svg osmarender

Osmararender renders osm data into an svg. It is constituted of 2 files:

- osm-map-features-z17.xml - is a kind of preferences file. Has to be edited in order to change the appearance of the map

- osmarender.xls - instructs on how the rendering should be done. Is advised not to change it.


I have started by altering the features file. For example: I remove all the elements besides the street names, or leave only lines and street names

(Not sure yet) It seems that when rendering, the svg becomes filled with elements which are no longer present (removed in the features-z17.xml file, therefore making it heavy and dificult to go through

Next step it to apply XSLT stylesheets to XML documents using xsltproc

using xmlstartlet

xmlstarlet tr osmarender.xsl osm-map-features-z17.xml > map.svg

using xmltproc

xsltproc osm-map-features-z17.xml > rendered-map.svg


Note: data file should be called data.osm, or otherwise osm-map-features-z17.xml data="data.osm" should be changed to the name to the file name in which is in

tanttttaaaaaa! the map (svg exported to svg)

Render-exp-04.png

Map Appearance

My aim is to render only the street names. This is are the steps to do it

  • pyton script (xpath) to parse the rules file, removing from the rules for unwanted visual elements. In this case all will be all besides the street's name

changing features file - python code

  • changed the svgBaseProfile.This can be set to full, basic of tinny(optimized to mobile phones) svgBaseProfie="basic"
  • remove background - in the svg the tag rect

In order to to so I had to edit the osmarender.xsl file and commented the background background

 <!-- <rect id="background" x="0px" y="0px" height="{$documentHeight}px" width="{$documentWidth}px" class="map-background"/> -->
  • frame removal

by altering the features file both minimumMapWidth="0.5" minimumMapHeight="0.5" to 1.5

osmarender xsl file

Currently I am looking more into how to change to osmarander.xsl file, so that just the elements that are wanted are rendered into the svg. Much work to do here

  • parsing

x = lxml.etree.XSLT(doc)

http://lxml.de/xpathxslt.html#xslt


Resources

http://www.use-it.be/europe/docs/OSMmanual/

http://wiki.openstreetmap.org/wiki/Osmarender

http://wiki.openstreetmap.org/wiki/Getting_Data Getting Data


Other Possibilities

  • GPS traces
  • Topographic map



relevant links

http://derickrethans.nl/what-is-openstreetmap.html Good explanation of OSM project

http://weait.com/content/openstreetmap-planet-file

http://derickrethans.nl/spatial-indexes-data-sqlite.html

osm Frameworks

Deploying your own Slippy Map

Pyrender-map rendering framework, programmed in Python

PythonOsmApi


Databases and data acess APIs

http://wiki.openstreetmap.org/wiki/Databases_and_data_access_APIs


xpath tutorials

http://infohost.nmt.edu/tcc/help/pubs/pylxml/web/index.html#intro

http://www.w3schools.com/xpath/default.asp

http://lxml.de/



---






OLD

OSM Elements

source: http://wiki.openstreetmap.org/wiki/Map_Features

maps are made up of a few simple elements (Data primitives): nodes, ways and relations. Each element may have an arbitrary number of properties (a.k.a. Tags) which are Key-Value pairs (e.g. highway=primary). (All editing interfaces use the elements and allow the input of tags. )


NODE - the basic element, building block. Nodes consist of latitude and longitude (Nodes are needed to define a way, but a node can also be a standalone unconnected point representing something or points of interest (POI). Standalone nodes should always have at least one Tag such as amenity=telephone). Example <node id="25496583" lat="51.5173639" lon="-0.140043" version="1" changeset="203496" user="80n" uid="1238" visible="true" timestamp="2007-01-28T11:40:26Z"><tag k="highway" v="traffic_signals"/> </node>


WAY - ordered interconnection of at least 2 or more nodes can describe a street, footpath, railway line, river, fence, power line, area or building outline. CLOSED WAY - the first and last nodes are identical, enclosing an AREA


Databases and data acess APIs

http://wiki.openstreetmap.org/wiki/Databases_and_data_access_APIs

API

The main API is the method of obtaining OSM data used by editors. Its limitations are that it will only return very small areas <0.25deg square.

This method of obtaining data should therefore be reserved for editing applications

TRAPI=

XAPI=

- Retrieve Particular Data Request Needs to be edited===

To acess data of a given area in http://www.openstreetmap.org/ go to Export Menu and check the coordinates. they organized as [bbox=lat,long, lat++, long++] area[1,3,2,0] or in other works [lat,long, lat++, long++]

EXAMPLES:

search all nodes in a small are in west Rotterdam:

wget http://open.mapquestapi.com/xapi/api/0.6/node[bbox=4.4552603823670465,51.91739525301985,4.46384345121436,51.920373035178464] -O rotterdam-west-test.osm


search pub nodes in Rotterdam

wget http://open.mapquestapi.com/xapi/api/0.6/node[amenity=pub][bbox=4.3142405612056836,51.87797066611181,4.588898764319719,51.973245376533505] -O rotterdam-pub-test.osm


search ways in a small area in west Rotterdam:

wget http://open.mapquestapi.com/xapi/api/0.6/way[bbox=4.4552603823670465,51.91739525301985,4.46384345121436,51.920373035178464] -O rotterdam-west-way-test.osm


Ways are where I can gather information about streets

Ways get rendered as streets/railways/footpaths/canals etc according to the tag(s) indicating what type of way it is. Ways are contiguous and non-branching. (You can get from beginning to end by following segments of the way, without "jumping" or backtracing)


eg: <tag k="addr:street" v="Mauritsstraat"/>


eg:

 <way id="5090250" visible="true" timestamp="2009-01-19T19:07:25Z" version="8" changeset="816806" user="Blumpsy" uid="64226">
   <nd ref="822403"/>
   <nd ref="21533912"/>
   <nd ref="821601"/>
   <nd ref="21533910"/>
   <nd ref="135791608"/>
   <nd ref="333725784"/>
   <nd ref="333725781"/>
   <nd ref="333725774"/>
   <nd ref="333725776"/>
   <nd ref="823771"/>
   <tag k="highway" v="unclassified"/>
   <tag k="name" v="Clipstone Street"/>
   <tag k="oneway" v="yes"/>
 </way>


All Elements

All elements (nodes, ways and relations) that match the given filter predicates can be requested using the following URL:

http://www.informationfreeway.org/api/0.6/*[...]

This returns an xml document containing nodes, ways and relations that match the search terms. For each matching way the nodes and referenced by that way are also returned. Likewise, for each matching relation the ways and nodes referenced by that relation are also returned.

Source: http://wiki.openstreetmap.org/wiki/Xapi