Remove street numbers from OSM maps - openstreetmap

I'm still working on my map project. I use mapnik tools to render my own maps.
Mapnik reads a xml file to style each tiles.
At this moment, i managed to remove street names and all stuff that was useless for my project. The only problem i have is about removing the street numbers, which still appear even when all useless layers are off.
I give you a pastebin link to my xml file: http://pastebin.com/ZRtmYBRz.
Do you know how i can remove the street numbers ? Thanks.
Before :
Now:

Try using a filter on the addr:housenumber tag of the nodes in the source file that contain that info. Once you get those, you can change the rendering by using a TextSymbolizer.
More info on https://github.com/mapnik/mapnik/wiki/TextSymbolizer

Related

manipulating Microsoft Word DOCX files that have links and track changes using Python

I have been using the excellent python-docx package to read, modify, and write Microsoft Word files. The package supports extracting the text from each paragraph. It also allows accessing a paragraph a "run" at a time, where the run is a set of characters that have the same font information. Unfortunately, when you access a paragraph by runs, you lose the links, because the package does not support links. The package also does not support accessing change tracking information.
My problem is that I need to access change tracking information. Or, more specifically, I need to copy paragraphs that have change tracking indicated from one document to another.
I've tried doing this at the XML level. For example, this code snippet appends the contents of file1.docx to file2.docx:
from docx import Document
doc1 = Document("file1.docx")
doc2 = Document("file2.docx")
doc2.element.body.append(doc1.element.body)
doc2.save("file2-appended.docx")
When I try to open the file on my Mac for complicated files, I get this error:
But if I click OK, the contents are there. The manipulation also works without problem for very simple files.
What am I missing?
The .element attribute is really an "internal" interface and should be named ._element. In most other places I have named it that. What you're getting there is the root element of the document part. You can see what it is by calling:
print(doc2.element.xml)
That element has one and only one w:body element below it, which is what you get when with doc2.element.body (.xml will work on that too, btw, if you want to inspect that element).
What your code is doing is appending one body element at the end of another w:body element and thereby forming invalid XML. The WordprocessingML vocabulary is quite strict about what element can follow another and how many and so forth. The only surprise for me is that it actually sometimes works for you, I take it :)
If you want to manipulate the XML directly, which is what the ._element attribute is there for, you need to do it carefully, in view of the (complex) WordprocessingML XML Schema.
Unlike when you stick to the published API, there's no safety net once ._element (or .element) appears in your code.
Inside the body XML can be relationships to external document parts, like images and hyperlinks. These will only be valid within the document in which they appear. This might explain why some files can be repaired.

How do I use OSM custom tags in Mapbox style

Here's a brief description of what I'd like to do (and I'm very, very new to this but seem to have hit a wall):
Display a map of color-coded buildings based on a custom tag (miamioh_lds).
What I've tried: in Mapbox Studio Classic starting with the Emerald style (coordinates 84.7286, 39.5033)
#building [miamioh_lds="uitcp"] {
polygon-fill: #f61313;
}
I would expect Hoyt Hall to be red, but it is not, even if I remove all other #building CartoCSS statements.
I would like the building filled, which is why I'm using tags and fill instead of using a data source, which seems to be focused at adding markers. I'm using Mapbox because my goal is to bring the map into Tableau (which I'll use to add a marker off dynamic data, which is why I need a fill, not a marker here).
Can I use custom tags in CartoCSS? If so, what am I doing wrong?
Thanks!

\Zend\Barcode generates wrong barcodes

using \Zend\Barcode (ZF 2.3.1) I'm not able to produce a readable barcode.
I've attached the picture generated (inside a PDF) by Zend Framework's tool.
The original text was 00000001C and the factory is code39. I've tried with code128 but same problem.
For some reason, my Motorola LS2208 can not recognize this barcode.
The specs of this scanner tells it should !
An other strange thing is all "code 39" or "code 128" generated on http://www.barcoding.com/upc/ are different from the ones produced by ZF.
I'm quite new to barcode generation and I just don't have any clue of what are the possible reason of this to fails. Can someone bring me some light here ?
Is the generated barcode correct, at least ?
The ZF documentation about specific renderers is very light...
OK, I finally found an answer to this.
First, I was generating barcodes with a width of 2cm.
This is really too tiny for 9 characters using the code 39 symbols.
The screenshot I've taken was made zooming on the PDF ; it shows a code where vertical bars were overlapping themselves.
Basically the solution is : NEVER EVER provide a 'factor' value lower than 1 to BarcodeZF::factory(), because this is what have makes bars overlap.

Open a Mapbox map in QGis

I'm looking for a way to display one of my Mapbox map in QGis (baselayer edited on mapbox.com & data uploaded from tilemill).
Did someone here already find a way ? Is there a feature or a plugin to do that ?
Thanks for your future answers !
Adrien
Yesterday, I found two solutions by myself :
1) the pretty official "TileLayer Plugin" QGis plugin
You'll have to write a TSV file (Tab Separated Values) with, at least, the name, the credits and the URL of your Mapbox map. The URL should look like :
http://a.tiles.mapbox.com/v3/mapboxId.mapId/{z}/{x}/{y}.png
You just have to replace mapboxId and mapId with your ids. See the github repository of the plugin for further informations and values to add to your TSV file (minZoom, maxZoom, etc).
Then, in the "settings" menu of the plugin, link the plugin to the directory of your TSV file ("external layers directory").
Finally, in the "add" menu of the plugin, select your map and click "add".
2) a XML file which is interpreted as a raster
Write a XML file with this code :
<GDAL_WMS>
<Service name="TMS">
<ServerUrl>http://a.tiles.mapbox.com/v3/mapboxId.mapId/${z}/${x}/${y}.png</ServerUrl>
</Service>
<DataWindow>
<UpperLeftX>-20037508.34</UpperLeftX>
<UpperLeftY>20037508.34</UpperLeftY>
<LowerRightX>20037508.34</LowerRightX>
<LowerRightY>-20037508.34</LowerRightY>
<TileLevel>18</TileLevel>
<TileCountX>1</TileCountX>
<TileCountY>1</TileCountY>
<YOrigin>top</YOrigin>
</DataWindow>
<Projection>EPSG:3857</Projection>
<BlockSizeX>256</BlockSizeX>
<BlockSizeY>256</BlockSizeY>
<BandsCount>3</BandsCount>
<Cache />
</GDAL_WMS>
Once again, replace the ids with yours. Then, open the file in QGis as a raster.

Get the tileset file names for TMXTiledMap

What's the best way to retrieve an array containing the file names of the files used to load a certain CCTMXTiledMap ? I need to get the tileset file names because I want to dispose of them personally from the Cache in a future.
According to the documentation and declaration of CCTMXTiledMap, you'll want to walk the property NSMutableArray* objectGroups. Otherwise, you'll need to maintain your own data structure.
This thread contains robust documentation and examples that should help you.
Open the tmx file, it is an xml file, and search for
it has a tag with a source attribute.
<tileset firstgid="1" name="sewer_tileset" tilewidth="24"
tileheight="24"> <image source="sewer_tileset.png" trans="ff00ff"
width="192" height="217"/> </tileset>
you can parse the xml and just find all tileset->images.
You will need an xml parser if you want to do it on the phone, here is a good tutorial on that :http://www.raywenderlich.com/553/how-to-chose-the-best-xml-parser-for-your-iphone-project