Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Indoor Maps - See Issue #675 #676

Closed
wants to merge 2 commits into from
Closed

Conversation

cfis
Copy link

@cfis cfis commented May 9, 2012

This commit adds in support for indoor maps by:

  • Adding cartesian crs
  • Adding identify projection
  • Cleaning up crs unbounded handling

This is a potential solution for https://github.com/CloudMade/Leaflet/issues/675.

Charlie Savage added 2 commits May 8, 2012 23:07
* Adding cartesian crs
* Adding identify projection
* Cleaning up crs unbounded handling

This is a potential solution for https://github.com/CloudMade/Leaflet/issues/675.
@mourner
Copy link
Member

mourner commented May 16, 2012

Thanks! I'm doing some refactoring of the projection code now, I'll look into merging this pull after this.

@gauravverma
Copy link

@cfis it would be really helpful if you could provide a simple example/demo. Thanks for your effort.

@cfis
Copy link
Author

cfis commented May 17, 2012

Sure, we have lots of live maps. Here is simple one:

http://myfamecon.zerista.com/viewer/2799?facet_id=14

Here is a complicated one:

http://iddba.zerista.com/viewer/3022

If you put "m." in front of the host name, you can also see the mobile version:

http://m.iddba.zerista.com/viewer/3022

@krisbulman
Copy link

Any hopes on getting this pull request in? Support for indoor maps is a great option.

@mourner
Copy link
Member

mourner commented Jun 22, 2012

@krisbulman sure, see my earlier comment. I'll get to this pretty soon.

@krisbulman
Copy link

Thanks for the update, seeing as it was over a month ago, i thought it may have got lost in the fray.

@@ -0,0 +1,28 @@
/*
* CRS.Cartesian is used for infinite coordinate systems that are not related to the Earth. Examples
* include indoor maps, gaming maps, etc. We assume 0,0 is in the bottom right corner.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean bottom left here? From code it seems that only latitude is inverted, but longitude is still from left to right.

@cfis
Copy link
Author

cfis commented Jun 23, 2012

Yes, bottom left is what I meant.

As for the falseEasting and falseNorthing, they provide a x an y offset for all points in the coordinate system. In our case we need this because sometimes we get data for indoor maps where the bottom left isn't 0,0 but is instead some random numbers pulled from a CAD system. For example, say we get a CAD drawing of a tradeshow floor where the bottom left booth might be at 100,100 and the top right booth at 200,200. We'd apply a false east of 100,100 so that the mapped booths take up the whole map area.

I convert to percentages because that seemed to fit best into how leaflet already works. I took a look at the transformations that were being used in the various CRS's and they were all expressed as percentages. For example, EPSG3395:

return new L.Transformation(0.5 / (Math.PI * r), 0.5, -0.5 / (Math.PI * r2), 0.5);

Thus I just went down the same route.

While on the subject of indoor maps, having to use LatLng objects to represent points in a cartesian coordinate system is pretty hacky feeling. What would be better in my view would be having a Point object which has an associated coordinate system with it. The interpretation of the point is then dependent on the coordinate system. That obviously is a much bigger change so I din't do it, but something for you to consider.

Hope these answers make sense - ping me if you have more questions.

@shramov
Copy link
Contributor

shramov commented Jun 23, 2012

Probably instead of falseEasting it better to add offset: new L.Point(0, 0) like in Icon?

@cfis
Copy link
Author

cfis commented Jul 2, 2012

Sorry, been out last week. Yes, I'm fine with that. Want me to update the patch or will add that?

@PhilAndrew
Copy link

Hi, how do I use this?

I added it to my source and built it and now should I do:
var map = new L.Map('map', {worldCopyJump: false, projection:L.Projection.Identity});

? Thanks!

@PhilAndrew
Copy link

Hi there,

Ok I tried to integrate this into the latest version of LeafletJS but zoom does not work.
Here is the demo application using code copied from your website:
http://topazschool.com/client/

Here is my github repository
https://github.com/philip142au/Leaflet
The changes
https://github.com/philip142au/Leaflet/commit/824be4f2bb5c4997758e5ea0c66e5b8a0a868370

I don't understand what the unbounded stuff is so I mostly left it out.

Would appreciate very much if someone can get the zoom working.

Thanks, Philip

@cfis
Copy link
Author

cfis commented Jul 22, 2012

Right, I remember this issue. The problem is the latlng class is wrapping when it shouldn't be. I updated LatLngBounds like this:

getCenter: function (unbounded) /-> LatLng/ {
return new L.LatLng(
(this._southWest.lat + this._northEast.lat) / 2,
(this._southWest.lng + this._northEast.lng) / 2,
unbounded);
},

Notice it now honors the unbounded parameter. I'd have to go back and verify if you have to change the calling sites, but don't see anything in my git log that shows that.

@mourner
Copy link
Member

mourner commented Jul 22, 2012

@cfis I removed the unbounded parameter from the Map code in master, now you need to just pass true when creating LatLng in unproject method of the projection.

@cfis
Copy link
Author

cfis commented Jul 23, 2012

Ok, sounds good. Are you still interested in merging these changes? Do you want me to update them first?

@mourner
Copy link
Member

mourner commented Jul 23, 2012

@cfis I'm not yet done with rethinking/refactoring of projection code so I'll keep this open for a while. No need to update yet.

@mourner
Copy link
Member

mourner commented Jul 25, 2012

@zilles
Copy link

zilles commented Sep 26, 2012

What's the status of this patch? Is this still required to use this to display indoor maps?

@mourner
Copy link
Member

mourner commented Feb 21, 2013

There were improvements in this regards in Leaflet 0.5 (see changelog), making flat maps easier, so I guess it's safe to close this.

@mourner mourner closed this Feb 21, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants