effrenus / yandex-map-react

70 stars 22 forks source link

Embedded user map #9

Open kachkaev opened 8 years ago

kachkaev commented 8 years ago

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.

effrenus commented 8 years ago

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.

kachkaev commented 8 years ago

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.

effrenus commented 8 years ago

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.

kachkaev commented 8 years ago

Looks promising! I'll try it tonight.

kachkaev commented 8 years ago

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 commented 8 years ago

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

effrenus commented 8 years ago

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