There is a maptypechanged event on the GMap2 class that you can use to
remove one set of markers and overlay another set.
Rather than read the xml file every time you switch, it would probably
be better to read both files into two different arrays when
initialising the map.
> There is a maptypechanged event on the GMap2 class that you can use to
> remove one set of markers and overlay another set.
> Rather than read the xml file every time you switch, it would probably
> be better to read both files into two different arrays when
> initialising the map.
I don't have a map example, but I'll elaborate on it for you. He's
basically saying (I think) that you should cache the markers instead
of reading from a file every time. This makes sense, as it cuts down
on the file-access wait time. (The only time to consider not doing
this is if your data sets are outrageously large to the point of
sucking too much memory from a client's computer. However, if your
sets are that large, it seems to me that you shouldn't be displaying
them dynamically from a kml file.)
Don't do this:
- Map Loads
- XMLDoc1 is read and points are added
- user clicks on the "change to other doc"
- XMLDoc1 is unloaded.
- XMLDoc2 is read and points are added
- user clicks on the "change to other doc"
- XMLDoc2 is unloaded.
- XMLDoc1 is read and points are added
You end up wasting a lot of time reading the files multiple times.
Instead, you want to cache the contents of the files in an array or
something. File access is slow, memory access is fast. Hence, you
want to do something more like this:
-Map Loads
-XMLDoc1 is read and data is put into array Doc1Data
-XMLDoc2 is read and data is put into array Doc2Data
-Points are displayed on the map from Doc1Data
-User switches modes. (No need to read file)
-Doc1Data is cleared from the map, but stays in memory
-Doc2Data is added to the map.
-User switches back to the first set.(No need to read file)
-Doc2Data is cleared from the map, but stays in memory
-Doc1Data is added to the map.
On Jul 3, 10:49 am, onda <profumodimi...@gmail.com> wrote:
> On 3 Lug, 13:12, igloo <iglo...@gmail.com> wrote:
> > There is a maptypechanged event on the GMap2 class that you can use to
> > remove one set of markers and overlay another set.
> > Rather than read the xml file every time you switch, it would probably
> > be better to read both files into two different arrays when
> > initialising the map.
On Jul 3, 2:58 am, onda <profumodimi...@gmail.com> wrote:
> Salve!
> I would like to have a map that takes the coordinates from a file xml,
> but when I change the map type, it takes the coordinates from another
> file xml
> I want that to correct the error between map and satellite map
> coordinates.
If it is a fixed offset in your area of interest you could just move
the markers by that offset when the map type changes.
Tanks Mkross, but I don't understood anything. I don't speak English
and I can't translate your suggestions. I only understand Geocodezip,
but itsn't a fixed offset.
So you can tell me if it's possible to connect two different maps,
like http://econym.googlepages.com/example_dualmap.htm. But not the
same. In this map the markers in the main map have the same
coordinates of the xhair in the minmap. And the error remain.
I would like to connect two maps, totally independent the one from
the other. So I can put the correct markers for every type of map.
When you passe from the sat-map to the map, a marker with some
determine coordinates, it is positioned in a different point.
So I would like at least one of these two solutions:
1) Or when I change the map type, the map takes the data of the
coordinates of the markers from another file xml. This way I can have
a file xml for the map and another for the sat-map. So I can eliminate
the error.
2) Or I would like to succeed in connecting two independent maps (what
they are found in two different web pages) as this
http://econym.googlepages.com/example_dualmap.htm, that however not
being independent, the marker of the map marks a place and the
corresponding marker (xhair) of the minimap it marks another place.
I would like that when click in the sidebar, I can see in the map the
marker of a map and in the minimap the marker of the other map. So I
can eliminate the error.
I hope you understand me. It's very difficult for me to explain me in
English.
On 4 Lug, 17:37, Ralph Ames <ralph.a...@gmail.com> wrote:
Earlier in the thread, they told you about a feature you could use to
detect when the user changes the map -
"There is a maptypechanged event on the GMap2 class ..."
Igloo also advised, that instead of fetching a new XML every time the
map type switches, you could fetch and store BOTH XML files in the
beginning. That would make switching from one set of markers to the
other work better.