|
The content of this page may not meet Wikimapia's policies,
this is unofficial storage source for any users purposes (upload images, make their pages, writing drafts for further project or documents, etc). You may read the official Wikimapia Documentation here. |
API box
Box function returns array of places in the given rectangle boundary box.
Contents |
Usage
Use this function by sending HTTP GET request to api.wikimapia.org. Response will content data in a given format (xml by default).
function=box &bbox=bbox|lon_min=lon_min&lat_min=lat_min&lon_max=lon_max&lat_max=lat_max|x=x&y=y&z=z [&language=language] [&category=category] [&format=format[&jsoncallback=jsoncallback]] [&pack=pack] [&options=mercator] [&disable=location,polygon] &key=key
Arguments
Argument | Description | Available values |
---|---|---|
format | output format | xml (default), kml, json, jsonp (+jsoncallback), binary |
pack | - | none (default), gzip |
key | Wikimapia API key | |
language | (optional) ISO 639-1 code, en is default (English) | |
category | (optional) filter by category | category id |
page | (optional) page number, bigger places will be on the first pages, 1 is default | 1 or above |
count | (optional) places per page. 50 is default | 1 to 100 |
options | Comma-separated values. mercator - all coordinates will be in the Mercator format instead of the default format | |
disable | Comma-separated values. Disables fields for xml, json(p) and binary formats. | location, polygon |
API box arguments
There are three ways to set borders of box area:
*bbox - 'lon_min,lat_min,lon_max,lat_max' | &bbox=37.617188,55.677586,37.70507,55.7271128
|
*lon_min, lat_min, lon_max, lat_max | &lon_min=37.617188&lat_min=55.677586&lon_max=37.70507&lat_max=55.7271128
|
*tile coordinates x, y, z (just like graphic map tiles from, use this feature for best caching results for your application, take a lower zoom!) | &x=687&y=328&z=10
|
Limitations
- (lon_max - lon_min) * 10000000 must be greater than 12100
- |(lon_max - lon_min) * (lat_max - lat_min)| * 10000000 must be less than 14641000000
- 100 places per page is maximal (bigger values are simply ignored), so to fetch all places, you need to iterate thru pages.
Output
Response may be in these formats: xml, json/jsonp, kml, binary
json/jsonp
<code class="json"> { "version":"1.0", // {string} format version "language":"en", // {string} language ISO code "folder":[ // {array} places inside { "id":"22139", // {int} place id "name":"Golden Gate National Recreation Area: Land's End", // {string} place title "url":"http://wikimapia.org/22139/Golden_Gate_National_Recreation_Area", // {string} original url "location":{ // {object} location of the place "north":37.788878, // {float} north point of MBR "south":37.78681, // {float} south point of MBR "east":-122.494082, // {float} east point of MBR "west":-122.508352, // {float} east point of MBR "lon":-122.4997044, // {float} center longitude of MBR "lat":37.7887088 // {float} center latitude of MBR }, "polygon":[ // {array} polygon { "x":-122.5077081, // {float} longitude "y":37.7867756 // {float} latitude }, { "x":-122.494082, "y":37.78681 }, { "x":-122.4945974, "y":37.7880983 }, { "x":-122.496593, "y":37.7874539 }, { "x":-122.4973226, "y":37.7875896 }, { "x":-122.4997044, "y":37.7887088 }, { "x":-122.5002408, "y":37.7885053 }, { "x":-122.5024295, "y":37.788234 }, { "x":-122.5035238, "y":37.7880305 }, { "x":-122.5060344, "y":37.7882001 }, { "x":-122.5071502, "y":37.7875048 }, { "x":-122.5071502, "y":37.7875048 }, { "x":-122.5077081, "y":37.7867756 } ] }, { "id":"39306", "name":"Sunset Reservoir", "url":"http://wikimapia.org/39306/", "location":{ "north":37.751885, "south":37.748407, "east":-122.4816585, "west":-122.4856715, "lon":-122.4817657, "lat":37.7520716 }, "polygon":[ { "x":-122.4858642, "y":37.751851 }, { "x":-122.4855638, "y":37.748356 }, { "x":-122.4815297, "y":37.7484917 }, { "x":-122.4817657, "y":37.7520716 }, { "x":-122.4817657, "y":37.7520716 }, { "x":-122.4858642, "y":37.751851 } ] } ] } </code>
xml
<code class="xml"> <?xml version="1.0" encoding="utf-8"?> <?access-control allow="*"?> <folder language="en" version="1.0"> <!-- places folder, language and version --> <place id="22139"> <!-- place id --> <name>Golden Gate National Recreation Area: Land's End</name> <!-- palce title --> <url>http://wikimapia.org/22139/</url> <!-- original url --> <location> <!-- location --> <lon>-122.4997044</lon> <lat>37.7887088</lat> <north>37.788878</north> <south>37.78681</south> <east>-122.494082</east> <west>-122.508352</west> </location> <polygon> <point x="-122.5077081" y="37.7867756"/> <!-- points of polygon x - longitude, y - latitude --> <point x="-122.494082" y="37.78681"/> <point x="-122.4945974" y="37.7880983"/> <point x="-122.496593" y="37.7874539"/> <point x="-122.4973226" y="37.7875896"/> <point x="-122.4997044" y="37.7887088"/> <point x="-122.5002408" y="37.7885053"/> <point x="-122.5024295" y="37.788234"/> <point x="-122.5035238" y="37.7880305"/> <point x="-122.5060344" y="37.7882001"/> <point x="-122.5071502" y="37.7875048"/> <point x="-122.5071502" y="37.7875048"/> <point x="-122.5077081" y="37.7867756"/> </polygon> </place> <place id="37781"> <name>Baker Beach</name> <url>http://wikimapia.org/37781/</url> <location> <lon>-122.4820018</lon> <lat>37.7986622</lat> <north>37.797543</north> <south>37.790659</south> <east>-122.4814655</east> <west>-122.4846845</west> </location> <polygon> <point x="-122.4820018" y="37.7986622"/> <point x="-122.4839115" y="37.7941181"/> <point x="-122.4877954" y="37.7894889"/> <point x="-122.4870336" y="37.7893447"/> <point x="-122.4856389" y="37.7903452"/> <point x="-122.4852097" y="37.790235"/> <point x="-122.4847269" y="37.7896415"/> <point x="-122.4839437" y="37.7893956"/> <point x="-122.4842119" y="37.7877253"/> <point x="-122.4831498" y="37.7880983"/> <point x="-122.4822807" y="37.788853"/> <point x="-122.481916" y="37.7897517"/> <point x="-122.4804783" y="37.7939994"/> <point x="-122.4805534" y="37.7952287"/> <point x="-122.4798667" y="37.7957713"/> <point x="-122.4793732" y="37.7968395"/> <point x="-122.4792659" y="37.7974244"/> <point x="-122.4803495" y="37.7978822"/> <point x="-122.4810898" y="37.7984736"/> <point x="-122.4810898" y="37.7984736"/> <point x="-122.4820018" y="37.7986622"/> </polygon> </place> </folder> </code>
kml
You may find the detailed information about this format Google maps http://code.google.com/intl/ru/apis/kml/documentation/
<code class="xml"> <?xml version="1.0" encoding="utf-8"?> <?access-control allow="*"?> <kml xmlns="http://earth.google.com/kml/2.1"> <Document> <Style id="orWiki"> <LabelStyle> <scale>0.8</scale> </LabelStyle> <IconStyle> <scale>0.5</scale> <Icon> <href>http://wikimapia.org/img/ge_st.png</href> </Icon> </IconStyle> <LineStyle> <color>99ffff55</color> <width>2</width> </LineStyle> </Style> <Style id="orWikiOn"> <LabelStyle> <scale>1</scale> </LabelStyle> <IconStyle> <scale>0.8</scale> <Icon> <href>http://wikimapia.org/img/ge_st.png</href> </Icon> </IconStyle> <LineStyle> <color>d71a1aff</color> <width>2</width> </LineStyle> </Style> <StyleMap id="orWikiChoose"> <Pair> <key>normal</key> <styleUrl>#orWiki</styleUrl> </Pair> <Pair> <key>highlight</key> <styleUrl>#orWikiOn</styleUrl> </Pair> </StyleMap> <Folder> <Placemark id="wm22139"> <name>Golden Gate National Recreation Area: Land's End</name> <description>Golden Gate National Recreation Area: Land's End <br/> <a href="http://wikimapia.org/22139/#ge">View or update this place information at Wikimapia.</a></description> <Region> <LatLonAltBox> <north>37.788878</north> <south>37.78681</south> <east>-122.494082</east> <west>-122.508352</west> </LatLonAltBox> <Lod> <minLodPixels>5</minLodPixels> <maxLodPixels>800</maxLodPixels> </Lod> </Region> <MultiGeometry> <LineString> <coordinates>-122.5077081,37.7867756,0 -122.494082,37.78681,0 -122.4945974,37.7880983,0 -122.496593,37.7874539,0 -122.4973226,37.7875896,0 -122.4997044,37.7887088,0 -122.5002408,37.7885053,0 -122.5024295,37.788234,0 -122.5035238,37.7880305,0 -122.5060344,37.7882001,0 -122.5071502,37.7875048,0 -122.5071502,37.7875048,0 -122.5077081,37.7867756,0</coordinates> </LineString> <Point> <coordinates>-122.4997044,37.7887088,0</coordinates> </Point> </MultiGeometry> </Placemark> <Placemark id="wm37781"> <name>Baker Beach</name> <description>Baker Beach <br/> <a href="http://wikimapia.org/37781/#ge">View or update this place information at Wikimapia.</a></description> <Region> <LatLonAltBox> <north>37.797543</north> <south>37.790659</south> <east>-122.4814655</east> <west>-122.4846845</west> </LatLonAltBox> <Lod> <minLodPixels>5</minLodPixels> <maxLodPixels>800</maxLodPixels> </Lod> </Region> <MultiGeometry> <LineString> <coordinates>-122.4820018,37.7986622,0 -122.4839115,37.7941181,0 -122.4877954,37.7894889,0 -122.4870336,37.7893447,0 -122.4856389,37.7903452,0 -122.4852097,37.790235,0 -122.4847269,37.7896415,0 -122.4839437,37.7893956,0 -122.4842119,37.7877253,0 -122.4831498,37.7880983,0 -122.4822807,37.788853,0 -122.481916,37.7897517,0 -122.4804783,37.7939994,0 -122.4805534,37.7952287,0 -122.4798667,37.7957713,0 -122.4793732,37.7968395,0 -122.4792659,37.7974244,0 -122.4803495,37.7978822,0 -122.4810898,37.7984736,0 -122.4810898,37.7984736,0 -122.4820018,37.7986622,0</coordinates> </LineString> <Point> <coordinates>-122.4820018,37.7986622,0</coordinates> </Point> </MultiGeometry> </Placemark> </Folder> </Document> </kml> </code>
Binary
This is a special format designed for mobile devices (and needs some tests). There are three parts: header (may be zero length), data variable names, data itself.
Example of binary output:
requestid=REQUESTID\x00id,title,polygon\x00DATA
In the DATA you will see rows of id,title,polygon. There are two bytes before each variable which present the length of variable (so 65536 is maximum length of variable data). REQUESTID it is your request ID passed in HTTP GET pequestid.
For example (id,title,polygon) in the data are:
Object id
\x00\x04\x00\x00\xF0\xED always will be for ID, it's integer unsigned
Object title
\x00\x07Library will be for the title "Library" - 7 bytes
Object polygon
If flag options=mercator is not set
\x00\x18\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC will be for polygon with 3 points - explanation: \x00\x18 is length (24 bytes), then each 4 bytes present an signed integers of: lon1 * 10000000, lat1 * 10000000, lon2 * 10000000, lat2 * 10000000, lon3 * 10000000, lat3 * 10000000, ..., lonN * 10000000, latN * 10000000;
If flag options=mercator set
\x00\x18\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC will be for polygon with 3 mercator points, explanation : \x00\x18 is length (24 bytes), then each 4 bytes present an unsigned integers of: x1, y1, x2, y2, x3, y3, ..., xN, yN;
Then directly goes another id,title,polygon,mercator without any delimiter. There also may be different variable names: id,title,mercator, id,title,polygon, etc.
Example
requestid=REQUESTID\x00id,title,polygon\x00 \x00\x02\xF0\xED // first object \x00\x07Library \x00\x18\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC \x00\x02\x01\xEС // second object \x00\x06Museum \x00\x18\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC // ...
For convenience, were placed line breaks and comments
requestid=REQUESTID\x00id,title,polygon\x00\x00\x04\x00\x00\xF0\xED\x00\x07\x00\x24\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC \x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x00\x04\x00\x00\x01\xEС\x00\x07Museum\x00\x24\x0F \xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC\x0F\xEC
Related error codes
Main article: API error codes
- *1200 Invalid Box Coordinates*
- *1201 Side of box is too small*
- *1202 Area of box is too big*