yandex-map-react icon indicating copy to clipboard operation
yandex-map-react copied to clipboard

Embedded user map

Open kachkaev opened this issue 8 years ago • 7 comments

I guess that the most common potential use of the component is an embedded map on a company's contacts page. These maps are sometimes drawn as a user map and can be simply added as an overlay:

var ml = new YMaps.YMapsML('http://maps.yandex.ru/export/usermaps/xxx/');
map.addOverlay(ml);

It would be nice to have this functionality in the React version too:

<Map center={ [55.754734, 37.583314] } zoom={ 10 } >
  <UserMapLayer id="xxx" onLoad={ this._userMapLoad } onLoadError={ this._userMapLoadError } />
</Map>

How difficult would this be to add? What alternatives to YMapsML exist in 2016? I might be pretty outdated about the way the things are done these days since I haven't been implementing anything YMaps-related for about 5 yrs. YMapsML seemed to be a good way of showing the driving directions to a company with no need to program the markers, the territories and the arrows manually.

kachkaev avatar May 15 '16 22:05 kachkaev

Yes, it would be handy) "My maps" is closed in favour "Map constructor", that doesn't support export yet. But such functionality in plans. I'll ask about support of YMapsML as export format and other variants.

effrenus avatar May 16 '16 09:05 effrenus

Got it. How would you recommend to display something like this on the map? https://yandex.github.io/mapsapi-examples-old/html/visualisationymapsml.html (this is from API v1 docs)

It does not have to be MapML per se, just wondering what else can substitute what I've already got.

kachkaev avatar May 16 '16 23:05 kachkaev

It's possible, https://github.com/effrenus/yandex-map-react-examples/tree/usermap, but a little bit tricky)

In readme I've described the process.

effrenus avatar May 17 '16 18:05 effrenus

Looks promising! I'll try it tonight.

kachkaev avatar May 18 '16 07:05 kachkaev

It worked, many thanks! I'll keep the issue open just if you want to improve the link to the constructor. Feel free to close it if you don't have such plans – my problem is solved!

kachkaev avatar May 19 '16 20:05 kachkaev

BTW there is still an issue with user maps / coordorder. If coordorder="longlat" is not specified for the <Map />, the user map becomes flipped. Mine moved from Penza to Kazakhstan :–)

screen shot 2016-05-19 at 22 00 30

screen shot 2016-05-19 at 21 30 59

kachkaev avatar May 19 '16 21:05 kachkaev

Yes, you are right. Default coordinate order is latlong. But coordinates in constructor stored in longlat order(

effrenus avatar May 25 '16 12:05 effrenus