Category: OSM

Osmosis in OSM

Till now, whatever changes I do in the OSM data, I again download the latest data from OSM or from http://extract.bbbike.org/ and import the fresh data in the database. But this is not the efficient approach.

So Today, I am going to introduce you with the term osmosis. You can read it in detail from here

Osmosis Installation

$sudo apt install osmosis

$osmosis -v                          //tell version

INFO: Osmosis Version 0.44.1

Now, it’s time to use the tool. The first command I tried to check the difference in the changesets of the two files was

$ osmosis –read-xml file=”ludh.osm” –read-xml file=”ludhiana.pbf” –derive-change –write-xml-change file=”planetdiff-1-2.osc”

Luckily, I encountered with an error.;)

SEVERE: Thread for task 1-read-xml failed
org.openstreetmap.osmosis.core.OsmosisRuntimeException: An output error has occurred, aborting.

After browsing on the internet then I came to know about my silly mistake. For the file ludhiana.pbf I was using the flag –read-xml instead of –read-pbf. The correct command is

$ osmosis –read-xml file=”ludh.osm” –read-pbf file=”ludhiana.pbf” –derive-change –write-xml-change file=”planetdiff-1-2.osc”

Similarly, we can explore osmosis a lot.

 

 

Inreased Zoom Level to 28 in OSM

Do you want to increase the zoom level of the OSM server? Then my friends, you are at right blog.;)

For it I am assuming that you have already made your pc an OSM server. While doing so, you have encountered with the term mod_tile. Am I right?

So, the whole story will revolve around mod_tile. If you are excited to know more about mod_tile then you can browse to my previous blogs.

Coming back to the topic we have to change overall 4 files in the directory mod_tile.

Edit the file /go/to/your/mod_tile/directory/openstreetmap-tiles-update-expire

EXPIRY_MAXZOOM=18

to

EXPIRY_MAXZOOM=28

The second file you have to edit is renderd.conf.

In [default] section uncomment the line MAXZOOM=18 and the change the value  from 18 to 28.

Note:- The file renderd.conf is located in two places. First one in mod_tile directory and other one in /usr/local/etc. You have to make changes in mod_tile directory because after making all necessary changes and recompiling mod_tile again. This renderd.conf file in mod_tile directory will automatically cloned to /usr/loca/etc.

Now, the turn comes for the third file i.e. mod_tile/includes/render_config.h

Change the variable

#define MAX_ZOOM 18

to

#define MAX_ZOOM 28

The last file which you have to edit is mod_tile/src/store_file_utils.c

This file need a lot of changes. So better to backup of this file initially.

 unsigned char i, hash[5];
to
unsigned char i, hash[7];

for (i=0; i<5; i++) {
to
for (i=0; i<7; i++) {

snprintf(path, len, “%s/%s/%d/%u/%u/%u/%u/%u.png”, tile_dir, xmlconfig, z, hash[4], hash[3], hash[2], hash[1], hash[0]);
to
snprintf(path, len, “%s/%s/%d/%u/%u/%u/%u/%u/%u/%u.png”, tile_dir, xmlconfig, z, hash[6], hash[5], hash[4], hash[3], hash[2], hash[1], hash[0]);

int i, n, hash[5], x, y, z;
to
int i, n, hash[7], x, y, z;

n = sscanf(path+i, “/%40[^/]/%d/%d/%d/%d/%d/%d”, xmlconfig, pz, &hash[0], &hash[1], &hash[2], &hash[3], &hash[4]);
if (n != 7) {
to
n = sscanf(path+i, “/%40[^/]/%d/%d/%d/%d/%d/%d/%d/%d”, xmlconfig, pz, &hash[0], &hash[1], &hash[2], &hash[3], &hash[4], &hash[5], &hash[6]);
if (n != 9) {

for (i=0; i<5; i++) {
to
for (i=0; i<7; i++) {

if (n != 4) {
to
if (n != 6) {

unsigned char i, hash[5], offset, mask;
to
unsigned char i, hash[7], offset, mask;

for (i=0; i<5; i++) {
to
for (i=0; i<7; i++) {

snprintf(path, len, “%s/%s/%d/%u/%u/%u/%u/%u.%s.meta”, tile_dir, xmlconfig, z, hash[4], hash[3], hash[2], hash[1], hash[0], options);
to
snprintf(path, len, “%s/%s/%d/%u/%u/%u/%u/%u/%u/%u.%s.meta”, tile_dir, xmlconfig, z, hash[6], hash[5], hash[4], hash[3], hash[2], hash[1], hash[0], options);

snprintf(path, len, “%s/%s/%d/%u/%u/%u/%u/%u.meta”, tile_dir, xmlconfig, z, hash[4], hash[3], hash[2], hash[1], hash[0]);
to
snprintf(path, len, “%s/%s/%d/%u/%u/%u/%u/%u/%u/%u.meta”, tile_dir, xmlconfig, z, hash[6], hash[5], hash[4], hash[3], hash[2], hash[1], hash[0]);

You have noticed that the hash value hash[5] is converted to hash[7]. It is due to make the metatile path longer. Not understood yet? Let me give an example.

The metatile take 5 bytes= 40 bits to cover all tiles for maximum zoom level 20. In simple words /var/lib/mod_tile/a/b/c/d/e/.meta

20 bits for x axis and 20 bits for y axis.

For zoom level 20 it require 5 bytes. Correspondingly for zoom level 28 it require 7 bytes.

28 bits for x axis and 28 bits for y axis.

That is why hash[5] changed to hash[7].

Now recompile your mod_tile again through the below commands.

make

sudo make install

sudo make install-mod_tile

sudo ldconfig

Now change the maxzooom parameter to 28 in Leaflet or any other Javascript library. You are done with it.

If you are having any problem with it. Then please do comment.

Data Structure- Relations

The basic data structure to map OSM are

  1. Nodes
  2. Ways
  3. Relations

To understand relations you should know about the first two elements. A Node is the x-y coordinate(basically a point) which is used to represent a point, icon on the map.

The table in the database which represent this nodes is planet_osm_nodes. This table defines the latitude, longitude of the point

Talking about the another element is “Ways” which is nothing but set of coordinates or a nodes to make a line, arc. In OSM it is used to represent rivers, boundary of a region etc.

The table in the database which represent these ways are planet_osm_ways. It displays unique id of a way, which nodes are participating to make a way and tags associated with the way.

Relations are an important data structure of OSM. Relations are basically combination of any of the two or all of the elements(Nodes, Ways, Relation). Relations are the conceptual database Model.

There are various types of relation like multipolygon, routes etc. To know more about relation types browse to http://wiki.openstreetmap.org/wiki/Types_of_relation

Invalid Multipolygons

  1. Unclosed Polygon like endpoint of way 2 and 3 are not joined.

400px-Multipolygon_Illustration_INVALID_1.svg

  1. If the endpoint of a way share more than two ways. As shown in fig endpoints of way #2 is shared by way #3, #1, #4 .

400px-Multipolygon_Illustration_INVALID_2.svg

Now, here I explain the table planet_osm_rels. There are columns id, rel_off, parts, members, tags.

  1. id– It assigns unique id to the osm relation. It can’t be null.
  2. rels_off– It tell number of members(nodes, ways, relation in total) participating to make a relation.
  3. parts– It tell which elements are participating by telling their unique id.
  4. members– It tell about the name of the element and associated role with it. Now here role describe the function of a member. Like, if type of relation is multipolygon than role of member(way) is inner or outer.

I think with this we have got a lot of overview of the data structures used in OSM.

Admin Levels at Different Zoom Levels

Few days back, I got a task to show admin_levels at various zoom levels. I here explain the task in detail.

It means like to show all states (admin_level=4) of India at particular zoom level with a different colour. Likewise to show all districts (having a particular admin_level) with another colour. It was quite interesting task.

To know more about admin_levels you can browse to the link.

http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative

The algorithm behind it is to give the reference to particular admin level. For example column “admin_level_2” will refer to all the rows where admin_level=2.

For this you must know basics of Postgresql.

– id: “zoom_levels”
name: “zoom_levels”
class: “”
geometry: “polygon”
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT boundary,
COALESCE(tags->’name:pa’,tags->’name:hi’,name) as name, way, COALESCE(
‘admin_level_’ || CASE WHEN admin_level IN (‘2’, ‘3’,’4′,’5′,’6′,’7′,’8′,’9′,’10’) THEN admin_level ELSE NULL END
) as admin_level, access,
religion,
way_area/NULLIF(!pixel_width!::real*!pixel_height!::real,0) AS way_pixels
FROM planet_osm_polygon
WHERE admin_level IN (‘2’, ‘3’,’4′,’5′,’6′,’7′,’8′,’9′,’10’)
) AS zoom_levels
properties:
minzoom: 3

The above is the complete layer with id “zoom_levels”. The styles to this layer will be given through this ID.

Now create fresh mss file called zoom-levels.mss

#zoom_levels {
[admin_level = ‘admin_level_2’][zoom>=3][zoom<5] {
text-name: “[name]”;
text-line-spacing: -1.3;
text-size:12;
text-halo-radius: @standard-halo-radius;
text-fill: #000;
text-face-name: @book-fonts;
line-color: #000;
polygon-fill: #765543;
polygon-gamma:0.4;
polygon-opacity: 0.5;}
[admin_level = ‘admin_level_3’][zoom>=5][zoom<6] {
polygon-fill: @landform-color * 0.1;
polygon-gamma:0.4;
line-color: #000;
polygon-opacity: 0.65;
text-name: “[name]”;
text-size:12;
text-line-spacing: -1.3;
text-halo-radius: @standard-halo-radius;
text-fill: #000;
text-face-name: @book-fonts;}
[admin_level = ‘admin_level_4’][zoom>=6][zoom<8]{
polygon-fill: #cccccc;
polygon-gamma:0.4;
line-color: #000;
polygon-opacity: 0.65;
text-name: “[name]”;
text-size:16;
text-line-spacing: -1.65;
text-halo-radius: @standard-halo-radius;

text-fill: #000;
text-face-name: @book-fonts;}
[admin_level = ‘admin_level_5’][zoom>=8][zoom<10] {
polygon-fill: #ccc149;
polygon-gamma:0.4;
line-color: #000;
polygon-opacity: 0.65;
text-name: “[name]”;
text-size:11;
text-line-spacing: -1.3;
text-halo-radius: @standard-halo-radius;
text-fill: #000;
text-face-name: @book-fonts;}
[admin_level = ‘admin_level_6’][zoom>=10][zoom<12] {
polygon-fill: #cc1039;
polygon-gamma:0.4;
line-color: #000;
polygon-opacity: 0.65;
text-name: “[name]”;
text-size:14;
text-line-spacing: -1.3;
text-halo-radius: @standard-halo-radius;
text-fill: #000;
text-face-name: @book-fonts;}
[admin_level = ‘admin_level_7’][zoom>=12][zoom<14] {
polygon-fill: #1e7b79;
polygon-gamma:0.4;
line-color: #000;
polygon-opacity: 0.65;
text-name: “[name]”;
text-size:13;
text-line-spacing: -1.3;
text-halo-radius: @standard-halo-radius;
text-fill: #000;
text-face-name: @book-fonts;}
[admin_level = ‘admin_level_8’][zoom>=14][zoom<16] {
polygon-fill: #6c7b6d;
polygon-gamma:0.4;
line-color: #000;
polygon-opacity: 0.65;
text-name: “[name]”;
text-size:13;
text-line-spacing: -1.3;
text-halo-radius: @standard-halo-radius;
text-fill: #000;
text-face-name: @book-fonts;}
[admin_level = ‘admin_level_9’][zoom>=16][zoom<17] {
polygon-fill: #d68035;
polygon-gamma:0.4;
line-color: #000;
polygon-opacity: 0.5;
text-name: “[name]”;
text-size:13;
text-line-spacing: -1.3;
text-halo-radius: @standard-halo-radius;
text-fill: #000;
text-face-name: @book-fonts;}
[admin_level = ‘admin_level_10’][zoom>=17][zoom<19] {
polygon-fill: #295332;
polygon-gamma:0.4;
line-color: #000;
polygon-opacity: 0.5;
text-name: “[name]”;

text-size:12;
text-line-spacing: -1.3;
text-halo-radius: @standard-halo-radius;
text-fill: #000;
text-face-name: @book-fonts

}
}

Include this mss file in the project.mml file as other mss files are included.

Now it’s time to compile the code.:)

carto project.mml > style.xml

Re-render the tiles. You may see the desired output at admin_level=4. It’s obvious that you should have India database.

admin.png

 

Playing with Languages in OSM

Hie Everyone.

As the title clearly explains the moto of the blog. So, let’s begin.

The logic which I have applied to display the name of the places in the OSM map is ->

Preference

Punjabi>Hindi>Original Name

Punjabi name is preferred first. If it null then Hindi will be preferred followed by original name.

The sample image is shown here.

punjabi.png

The whole source code is the following link. You can clone it from here.

https://github.com/GreatDevelopers/pbOSM

Now, without wasting much, I here repeat that particular code. It’s very easy. You can customize it in your own way.

Open the project.mml file. In sql queries replace the column name with the line

COALESCE(tags->’name:pa’,tags->’name:hi’,name) as name

Here coalesce function will display the first not null value. If all values are null then it will display no value.

Make sure you have installed the fonts of the corresponding language.

$sudo apt-get install fonts-noto-cjk fonts-noto-hinted fonts-noto-unhinted fonts-hanazono ttf-unifont

The ttf files of all these fonts should be included in the fonts directory which your Mapnik is loading. In my case it is /usr/local/share/fonts/

You can translate English word to Punjabi from the following websites.

http://punjabi.indiatyping.com/

https://www.google.co.in/search?client=ubuntu&channel=fs&q=english+punjabi+translator&ie=utf-8&oe=utf-8&gfe_rd=cr&ei=GklaWefiEcXy8AeNnKrQDQ

If you have any query related to it. Please do comment.

Thank you

Nominatim on local server

In my previous blog I have installed Nominatim in my home folder and changed the directory of local server from /var/www/html to /home/amisha.

To do the same you can refer my blog -> reference

That was creating lot of problem to me as I was not able to run any php file in /var/www/html directory. So, first of all I restore the local server to the default directory.

But I was not able to run the Nominatim located in the /var/www/html directory.

eee.png

After reading the settings.php file I came to know that

@define(‘CONST_Website_BaseURL’, ‘http://&#8217;.php_uname(‘n’).’/’);

to

@define(‘CONST_Website_BaseURL’, ‘http://&#8217;.php_uname(‘n’).’/Nominatim/build/website/’);

Here, http://&#8217;.php_uname(‘n’) means username -> http://amisha/ or localhost

It was searching to the localhost/search.php but the actual path was localhost/Nominatim/build/website/search.php

ccc

Finally, the problem is solved.

 

 

 

Nominatim-> Search OSM with name

Nominatim-> Search OSM with name

Hie guys. Today, I am going to nomenclature my OSM map.:p

Implementation

You can clone the repo from https://github.com/openstreetmap/Nominatim

The detailed information of installation and set up of nominatim is given in ‘docs‘ directory.

Here, I will discuss the summary and struggles you may face while doing it.

$sudo apt-get install osmosis  /* For running continuous updates */

$sudo apt-get install php5-pgsql

After installing the software dependencies when I tried to import the data I encountered with the following error.

amisha@amisha:~/git/Nominatim$ ./build/utils/setup.php –osm-file ~/Downloads/ludh.pbf –all

PHP Warning:  require_once(DB.php): failed to open stream: No such file or directory in /home/amisha/git/Nominatim/lib/db.php on line 3
PHP Fatal error:  require_once(): Failed opening required ‘DB.php’ (include_path=’.:/usr/share/php:/usr/share/pear/share/php’) in /home/amisha/git/Nominatim/lib/db.php on line 3

It means ‘db.php’ requires file ‘DB.php’ for it’s execution. On goggled I came to know that ‘DB.php’ file comes with the installation of PEAR::DB. It means I have not installed it initially.

PEAR::DB Installation

$wget http://pear.php.net/go-pear.phar

$php go-pear.phar

$pear install DB

On executing the same command with the user <amisha> an error of permission denied came. Then I realized correct system user is postgres. It’s through not only.

amisha@amisha:~/git/Nominatim$ sudo -u amisha ./build/utils/setup.php –osm-file ~/Downloads/ludh.pbf –all
Create DB
createdb: database creation failed: ERROR:  permission denied to create database
ERROR: Error executing external command: createdb -E UTF-8 -p 5432 nominatim
Error executing external command: createdb -E UTF-8 -p 5432 nominatim

$ sudo -u postgres ./build/utils/setup.php –osm-file ~/Downloads/ludh.pbf  –all

Create DB
Setup DB
Postgres version found: 9.3
CREATE EXTENSION
ERROR:  could not access file “$libdir/postgis-2.2”: No such file or directory
ERROR: pgsql returned with error code (3)
pgsql returned with error code (3)

Again error in the same command but of different type. The above error explains itself only. So, what you are waiting for. Install postgis-2.2.

$ sudo apt-get install postgresql-9.3-postgis-2.2

While installing it I got an error of broken packages which I solved it with the help of my previous blog.

You can verify that whether database nominatim created or not.

postgres-# \l
List of databases
Name    |  Owner   | Encoding | Collate | Ctype |   Access privileges
———–+———-+———-+———+——-+———————–
gis       | amisha   | UTF8     | en_IN   | en_IN |
nominatim | postgres | UTF8     | en_IN   | en_IN |
postgres  | postgres | UTF8     | en_IN   | en_IN |
template0 | postgres | UTF8     | en_IN   | en_IN | =c/postgres          +
|          |          |         |       | postgres=CTc/postgres
template1 | postgres | UTF8     | en_IN   | en_IN | =c/postgres          +
|          |          |         |       | postgres=CTc/postgres
(5 rows)

After the installation and importing the database, I browse to the search.php file on the local server. But, unfortunately I got the Internal Server Error.

Internal Server Error

SQL Error: DB Error: connect failed

Details: [nativecode=pg_connect(): Unable to connect to PostgreSQL server: FATAL:  role “www-data” does not exist] ** pgsql://@/nominatim

This error came because the owner of nominatim database was postgres and in settings.php permissions was given to the <www-data> user. So, I changed the ownership of database to <www-data> also. You can do vice versa.

postgres=# create role “www-data”;
CREATE ROLE
postgres=# ALTER ROLE “www-data” WITH login;
ALTER ROLE

After re-loading the page the category of the error was same but with different type. This time it was not able to find the tables shown below.

in.png

It means that the defination of the tables and functions were missing. Command to create functions. I think errors loves me a lot that is why coming again and again.:P

$ ./build/utils/setup.php –create-functions

Functions
ERROR:  type geometry does not exist
ERROR: pgsql returned with error code (3)
pgsql returned with error code (3)

It means that the type geometry was missing which come with the extension postgis.

nominatim=# create extension postgis;
CREATE EXTENSION

$ ./utils/setup.php –create-functions
Functions
CREATE FUNCTION
CREATE FUNCTION
ERROR:  permission denied for language c
ERROR: pgsql returned with error code (3)
pgsql returned with error code (3)

The above command runs with the owner of the database <postgres>.

$sudo -u postgres ./utils/setup.php –create-functions

$ sudo -u postgres ./utils/setup.php –create-tables

ERROR:  type “wikipedia_article_match” does not exist
ERROR: pgsql returned with error code (3)
pgsql returned with error code (3)

I have ignored this error as it demands for the optional data to be import.

$ ./utils/specialphrases.php –wiki-import > specialphrases.sql

$sudo -u postgres ./utils/setup.php –osm-file ~/Downloads/ludhiana.pbf –all –osm2pgsql-cache 2300 | tee setup.log

The above command will cache the imported data.

Then browse to the file search.php and you will be able to see the Nominatim main page through local server.

nom.png

The tiles are coming from the osm.org website and the it is using the local database. You can check it over the settings.php file. Now, my next task is to server the local tiles in the nominatim. I don’t know whether it is possible or not. Will update you soon.

I hope you will like it.

 

 

 

 

 

The Struggle we’re in TODAY

The Struggle we’re in TODAY

Today I tried to show the cash availability and queue for various ATMs in OSM map which is today’s need;)

So, here we go.

Make a file named “atm.txt” having content as follows. Actually, in this file I have taken a raw data to just test the things.

lat     lon     title   description     icon    iconSize        iconOffset
30.8791058      75.8589964      Punjab National Bank    Cash Available Rs. 2000000, Queue 750   ca.png  24,24   0,-24
30.8434801      75.8623353      Oriental Bank Of Commerce       Cash Available Rs. 1000000, Queue 600   ca.png  24,24   0,-24
30.893997       75.8581242      HDFC Bank       Cash Available Rs. 100000, Queue 100    ca.png  24,24   0,-24
30.8608311      75.8594127      Centurion Bank  Cash Available Rs. 500000, Queue 450    ca.png  24,24   0,-24
30.8782978      75.8589696      Oriental Bank Of Commerce       Cash Available Rs. 1500000, Queue 500   ca.png  24,24   0,-24
30.8609502      75.8595304      HDFC ATM        Cash Available Rs. 1000000, Queue 600   ca.png  24,24   0,-24

Add the few lines in the file slippymap.html. It means we are adding a new layer named “Cash Available” with the location of a file “atm.txt” in the same directory.

var pois = new OpenLayers.Layer.Text( “Cash Available”,
{ location:”./atm.txt”,
projection: map.displayProjection
});
map.addLayer(pois);

Now, you are done with it. Here you can see the icon and the name of the new layer <Cash Available> in the blue box.

cash

On triggering the icon once, you can see the datails of the Bank.

csh

I hope you liked it.

Have a nice day:)

 

 

 

 

Customizing OSM Map

Customizing OSM Map

  1. Yesterday, I got retention task of <Customizing OSM Map>to be in GD. So, I started to work on it.;)

I decided to modify osm database. What I have done with my map will be clear to you soon.:)

The following command will import the database.

osm2pgsql –slim -k -d gis -C 1500 –number-processes 4 /usr/local/share/maps/planet/tcc.pbf

-k or –hstore here means add tags without column to an additional hstore (key/value) column to PostgreSQL tables. In layman language, using this flag while importing data will add a new column <tags> into the tables. But I got the the following error.

Error:

osm2pgsql version 0.91.0-dev (64 bit id space)

Using built-in tag processing pipeline
Using projection SRS 3857 (Spherical Mercator)
Setting up table: planet_osm_point
Osm2pgsql failed due to ERROR: CREATE UNLOGGED TABLE planet_osm_point (osm_id int8,”access” text,”addr:housename” text,”addr:housenumber” text,”addr:interpolation” text,”admin_level” text,”aerialway” text,”aeroway” text,”amenity” text,”area” text,”barrier” text,”bicycle” text,”brand” text,”bridge” text,”boundary” text,”building” text,”capital” text,”construction” text,”covered” text,”culvert” text,”cutting” text,”denomination” text,”disused” text,”ele” text,”embankment” text,”foot” text,”generator:source” text,”harbour” text,”highway” text,”historic” text,”horse” text,”intermittent” text,”junction” text,”landuse” text,”layer” text,”leisure” text,”lock” text,”man_made” text,”military” text,”motorcar” text,”name” text,”natural” text,”office” text,”oneway” text,”operator” text,”place” text,”population” text,”power” text,”power_source” text,”public_transport” text,”railway” text,”ref” text,”religion” text,”route” text,”service” text,”shop” text,”sport” text,”surface” text,”toll” text,”tourism” text,”tower:type” text,”tunnel” text,”water” text,”waterway” text,”wetland” text,”width” text,”wood” text,”z_order” int4,”tags” hstore,way geometry(POINT,3857) ) WITH ( autovacuum_enabled = FALSE ) failed: ERROR:  type “hstore” does not exist
LINE 1: …xt,”width” text,”wood” text,”z_order” int4,”tags” hstore,way…

Then, I got to know that I have not created the extension hstore.

Solution:

create extension hstore;

Note: Run above command only after connecting to database where tables are stored. In my case it was “gis” only.

Then I modified OSMBright.xml file. What I want is if there are tags available for building(polygon) then display it otherwise display name of the building. So, according to it the logic is –

SELECT COALESCE(landuse, leisure, “natural”, highway, amenity, tourism) AS type, CASE WHEN (tags->’opening_hours’) IS NOT NULL THEN (tags->’opening_hours’) ELSE name END AS name, way_area AS area, ST_PointOnSurface(way) AS way FROM planet_osm_polygon WHERE name IS NOT NULL AND ST_IsValid(way) ORDER BY area DESC;

Actually, I have shown here full command but important thing to note here is the CASE condition.

\d+ <tablename>;

It will describe structure of the table. Through this you can check whether new column named tags added or not.

tags

update

The above image clearly shows that instead of displaying the name of the place i.e “Peer Khana” it is showing value of the attribute <tag> i.e. “24/7”.

Then I tried to modify the names of the buildings.

update planet_osm_polygon set name=’Amisha Colony’ where name=’Anmol Colony’;

amisha.png

It was very interesting task to me as I have modified osm database first time and no doubt learnt Postgresql also.

Bye Bye.

PopUp Menu in OSM

What is the benifit of making own OSM tile server if we can’t style are own map. So here I come to tell you how to add the information(“PopUp Menu”) in your own OSM map.

So Let’s Start.

Edit the file “slippymap.html”.

The layer named “My Points”contains the information of the few shops near Gill road.

Enter the new layer just after the defination of the variable “map” in the init() function.

var pois = new OpenLayers.Layer.Text( “My Points”,
{ location:”./textfile.txt”,
projection: map.displayProjection
});
map.addLayer(pois);

 

Here textfile.txt is the file containing information of the shops in it. The below picture shows the format of the data stored in the textfile.

text1

Be sure the name of the image in the textfile and the image existing in the same directory should have same name.

Now refresh your map and you will be able to see the changes.

jh