📜 ⬆️ ⬇️

TileMill - cartographic design studio

image

TileMill is a mapping tool that allows you to quickly and easily create and design maps for the web using different data sources. It is based on Mapnik, a powerful open source library. TileMill is not a general purpose mapping tool, it is designed to solve a narrow set of tasks.

The principle of operation of TileMill is very simple. You import your vector data into the studio. TileMill supports ESRI shapefiles, KML, GeoJSON, GeoTIFF and, more recently, PostGIS support. Make it all up with CSS like Carto and export it to one of the formats (PNG, PDF or MBTiles).
')
Opportunities



For details, I invite under the cat.

System requirements




Mapnik

Mapnik is an open source library for rendering raster maps from vector data. It was developed for the OpenStreetMap project by our compatriot Artyom Pavlenko, and today is used by many resources, among which it is worth noting the Russian Space Photos . This library is also used by the OpenStreetMap and MapQuest projects for some of their maps. Mapnik is written in C ++ and Python. It uses the AGG library and makes it possible to smooth objects on the map with sub-pixel precision. Supports ESRI shapefiles, PostGIS, TIFF rasters, .osm files, as well as any GDAL and OGR formats. Packages are available for most Linux distributions, binaries are available for Mac OS X and Windows.

Install Mapnik

svn checkout -r 2898 svn.mapnik.org/trunk mapnik2
cd mapnik2
python scons/scons.py configure
python scons/scons.py
sudo python scons/scons.py install



Little about cartography

For those familiar with GIS or cartography, I’ll immediately say that maps in TileMill are always projected into Web Mercator (EPSG: 900913). This projection is also used by Microsoft Bing Maps, Google Maps and ESRI ArcGIS Online.

The format of the spatial referencing system proj4 SRS (spatial referencing system) is widespread. This system provides the ability to describe the projection and coordinate system of the data source in one record - the SRS string (SRS string). For example, the SRS line describing WGS84 looks like this:

+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs

In most cases, TileMill can detect SRS loaded shapefiles and other data sources. But sometimes you may need to specify the SRS yourself, in the case when TileMill cannot determine it on its own.

What are tiles?

image
A tile is a 256x256 pixel PNG / JPEG bitmap image.

TileMill supports different levels of presentation. The presentation level is the predefined map display scale. OpenStreetMap, Google Maps and other web-mapping services provide tiles of 256x256 pixels at the zero presentation level and double the dimensions at each subsequent level. For example: at the zero level of representation, the whole world is seen, at the sixth level - a country of medium size, on the eleventh - a megacity. At the sixteenth level, you can see the individual houses.

In addition, TileMill supports exporting maps to the MBTiles format. This format was designed specifically for storing maps and accessing them both online and offline.

Mbtiles

MBtiles is a specification for storing sliced ​​tiles in SQLite DBMS with the ability to instantly return. Such a data format allows you to transfer thousands, hundreds of thousands and even millions of tiles in one file.
The MBTiles upload speed is higher than the upload speed of millions of individual tiles, when booting to USB, mobile devices, or transferring over the network. The difference in speed between accessing the database or file system when using MBTiles is insignificant.
Since MBTiles use embedded SQLite DBMS, they can be used without an Internet connection.
Tiles are stored as BLOB (Binary Large OBjects - the storage format of large volumes of binary data), therefore, can be used in most SQLite clients.

Install TileMill

The source code for TileMill is available on Github.

git://github.com/mapbox/tilemill.git
cd tilemill
./ndistro


Run ./tilemill.js . Now we start the browser, by default TileMill should be available at localhost:8889 localhost:8889 .

Interface overview


Following the link localhost:8889 localhost:8889 set of pre-installed projects will be available to you. Selecting one of them will take you to the edit page.

image
  1. Toolbar
  2. Map
  3. List of layers
  4. Font selection and color palette
  5. Code editor



image
Toolbar
  1. Settings
  2. Project name
  3. Save project
  4. Export
  5. Project Settings
  6. Close project



image
Card interface
  1. Map
  2. Scale
  3. Expand full screen



image
List of layers
  1. Add layer
  2. Reorder layers
  3. Layer geometry icon
  4. Identifiers and Classes
  5. View attribute table layer
  6. Edit layer
  7. Delete layer



image
View attribute table

image
Style editor
  1. Active tab
  2. Delete style
  3. Inactive tabs
  4. Create New Style
  5. MSS syntax help
  6. Line numbers
  7. Text area



Carto example


Carto is a CSS-like map design language used in TileMill. The following code sets the color and dimensions for the lines of the layer with the layer identifier and adds the glow property to it.
#layer {
line-color: #C00;
line-width: 1;
}

#layer::glow {
line-color: #0AF;
line-opacity: 0.5;
line-width: 4;
}


image
That's what we get in the end.

Total


The topic came out voluminous, but I still have something to tell. If you are interested in this article, then I can continue and review TileMill in more detail. In addition, there is another product that is used in conjunction with TileMill - this is TileStream. It makes sense to consider him too. Thanks for attention.

useful links

  1. Official site
  2. Source
  3. Mapbox
  4. Development team
  5. GIS Lab - Russian GIS Community
  6. Space images
  7. Mapnik
  8. Feature Overview (video)
  9. Mbtiles
  10. Carto


PS: You can find support on the IRC channel #mapbox on the Freenode network.

PPS: Unfortunately, I did not find a blog close in subject, so I posted it in open source. As I recall, a couple of times on Habré was raised the topic of creating a blog dedicated to GIS. Judging by the survey , it is interesting to readers. Maybe after this topic, the UFO will be interested in GIS?

UPDATE : continued here .

Source: https://habr.com/ru/post/120676/


All Articles