V
V
Vasily Vyaznikov2016-12-05 16:16:20
JavaScript
Vasily Vyaznikov, 2016-12-05 16:16:20

How can you create your own interactive map?

It is necessary to implement an interactive map.

Never encountered such a problem.
With the help of Google, I realized what is being done with the help of svg graphics.
The gag here is that I don’t understand how to process the effect when hovering over the area (specifically, here, paint over the circle and display a hint with the name of the city), and I don’t know how to handle the click so that the information panel appears (screen 3).

How can this be implemented?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
M
mletov, 2016-12-05
@mletov

Why svg?
Put the map in the background,
start a table in the database in which you will store markers, indicating the coordinates on the map and other useful information.
Loop over background (position absolute). Change the style of the circle on hover
via css hover Process
the click via jquery click

K
Konstantin Kitmanov, 2016-12-05
@k12th

So SVG reacts in the same way to hover and clicks. On click, it's easier to show divs, it's not very convenient to display text in svg.
Open Layers/Leaflef/clip-mask -- not needed.

E
Eugene Wolf, 2016-12-05
@Wolfnsex

Well, offhand, you can make many layers (as many as there are regions on the map), put a clip-mask on them and handle the click on each individual layer accordingly. There already name them as you like, add IDs/classes, etc.

G
GreatRash, 2016-12-05
@GreatRash

Open Layers for example. Or Leaflets .

X
xmoonlight, 2016-12-05
@xmoonlight

Raphael.js (there are even examples)

A
Anatoly Scherbakov, 2016-12-06
@Altaisoft

Used leaflet.js for similar tasks. The described functionality is already there, the API is very simple and understandable, well documented. Why invent bicycles when competent people have already made a decision? The only thing you need to do:
- Write a function or REST API that returns the data for the pop-up
- Write a function that returns the HTML for that pop-up.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question