Skip to content

New method LatLonPoint.toPixels #265

Open

Description

@evgeni-spasov

I've forked the project and added a method called LatLonPoint.toPixels
It returns the top and left pixel coordinates for the point according to map containing DOM element. It is for microsoft7 provider. I'm not aware if other providers can be made to calculate the same thing?
So I'm opening this discussion - is it possible to have an implementation of this method in Mapstraction for other providers?

See a commit about my implementation: evgeni-spasov@b4437fd

Activity

  1. vicchi commented on Aug 6, 2013

    @vicchi
    Member

    Thanks for writing this; this is all good.

    So I'm opening this discussion - is it possible to have an implementation of this method in Mapstraction for other providers?

    The short answer is ... it depends. We'd need to check that there's either a one to one correlation between the (new) Mapstraction API call and one in each of the supported providers, or that this is capable of being calculated if there isn't a direct correllation.

    For example, the HERE maps API has a nokia.map.Display.geoToPixel() API call which could be used, whereas there's no equivalent in Google's v3 API though this can be determined with some code (see http://krasimirtsonev.com/blog/article/google-maps-api-v3-convert-latlng-object-to-actual-pixels-point-object).

    So in order to add this as a supported call in Mapstraction, we can't implement it solely for a single provider, in this case Microsoft/Bing v7. This would be contrary to the whole point of Mapstraction. It would need to be implemented across all providers. Or, at the bare minimum, implemented in a critical mass of providers, though this isn't ideal.

    Is this something you would consider helping with via your fork of the project?

  2. evgeni-spasov commented on Aug 7, 2013

    @evgeni-spasov
    Author

    You are describing exactly what my intend was. I'm going to work on my fork to support more and more providers. And hopefully this will be merged at some point when ready.

    Thank you for the information on HERE maps. I recently found that Bing has similar feature, which I missed - map.tryLocationToPixel() - so I'll update my code for Bing v7 using the API.

  3. vicchi commented on Aug 7, 2013

    @vicchi
    Member

    That's great and really good to hear. Two quick points ... firstly make sure your fork is using the release-3.0 branch so you pick up the latest code. Secondly, when you come to expose the new API call through the Mapstraction core, feel free to get in touch if you need any help as this isn't documented. In fact, keep in touch and feel free to ask for as much or as little help as you need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions