NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

HI,

i want to display all my points in the map and adjust zoom automatically based on the number of points, if there are more points all points should be shown with zoom out, if there are 1 point only that point has to be shown with max zoom level

please suggest solution how to achieve this

Thanks Kiran

asked 21 Feb '13, 09:52

amkiranv's gravatar image

amkiranv
1333
accept rate: 0%

edited 21 Feb '13, 20:08

gormo's gravatar image

gormo
2.9k32660

1

Where? You added Nominatim and JOSM as tags but I guess you are using either Leaflet or OpenLayers instead.

(21 Feb '13, 09:56) scai ♦

yes am using OpenLayers

(21 Feb '13, 10:07) amkiranv

This is a OpenLayers question.

Use a http://dev.openlayers.org/apidocs/files/OpenLayers/BaseTypes/Bounds-js.html , fill it with all your points, then zoom the OpenLayers viewport to the created bounds object using http://dev.openlayers.org/apidocs/files/OpenLayers/Map-js.html#OpenLayers.Map.zoomToExtent .

permanent link

answered 21 Feb '13, 20:06

gormo's gravatar image

gormo
2.9k32660
accept rate: 13%

edited 21 Feb '13, 20:07

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×122

question asked: 21 Feb '13, 09:52

question was seen: 5,891 times

last updated: 21 Feb '13, 20:08

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum