8

I created a custom SVG country map and plotted it with jVectorMap. Now I am trying to insert markers using lat/long on this map, but I don't understand how the "bbox" x;y system works.

I guess I have to do an inverse projection of the max and min lat/long of my map, but even when looking at the Alaska example below I don't understand how the x;y was obtained. I tried using the inv_aea from proj.js without recognizing anything relevant.

projection: {
centralMeridian: -100,
type: "aea"
}

insets: [{
"left": 0
"top": 440,
"width": 220,
"height": 147
"bbox":[{
    "y": -8441281.712315228,
    "x": -5263934.893342895
},{
    "y": -6227992.545028123,
    "x": -1949631.2950683108
}
}]
Tibo
  • 81
  • 3

2 Answers2

0

The width and height of insets must be equal to map width and height.

-1

I honestly don't understand exactly what you are trying to do, but if you mean to insert markers using an image as map you have to consider that your source coordinates (a latitude/logitude pair) are expressed using WGS84 (EPSG:4326) standard (a point on an ellipsoid), while you mean to represent them on a plain surface. The thing you should do is using global spherical mercators projection, (see http://spatialreference.org/ref/epsg/3785/), to represent your coordinates in meters (EPSG:3785). Once you did this transformation (i suggest you to use this library or a similiar: proj4js) you can make simple calculations and proportions for representing your point on a plain map.

I've set up a working jsfiddle using an example i made over two years ago before starting university, i was a beginner in programming so please forgive bad code formatting.

LIVE DEMO

you can check the live demo by clicking the link above
Morrisda
  • 1,380
  • 1
  • 11
  • 25
  • Thanks but the problem is we are using jvector map and creating custom map. for custom map the projection is not correct, so that i am not able to google map coordinates to proper position. for that i need projection centralmerdian, insets like x,y for india custom map. – Ananta Prasad Dec 22 '15 at 12:28
  • Are you sure projection is not correct and not your custom map ? For checking projections i suggest you checking this: http://twcc.fr/# – Morrisda Dec 22 '15 at 19:53