0

I want to map spatial data in javascript. Using leaflet and openlayers wont help since the spatial data getting used has special coordinates (x, y) which arent projectable. Look here for an example how these coordinates might look.

1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Nov 11, 2021 at 12:30

1 Answer 1

0

Your spatial data needs a spatial reference. Then you can use Leaflet/openlayers. The spatial reference doesn't need to be real, especially if you don't care where it gets placed 'in the real world'.

No spatial reference = not spatial data.

If you want to persist with your data NOT having a spatial reference, then you don't have spatial data - you just have pixel values (or similar). I mention this because this may help you frame your question or look for a more appropriate solution, like a graphics/photoshop type solution an dyou may need to move away from having multiline datatypes. .

But giving your data a spatial reference and then using leaflet/similar, is actually quite easy!

I would personally just play around with a map projection that roughly fits somewhere you like in the real world - It doesn't matter where! Pick New York/England/Moscow, who cares. Just somewhere. Then find a map projection that fits that area (you can look for them here https://epsg.io/

You just need a reference EPSG number.

have a look at ICRS in the Leaflet documentation. https://leafletjs.com/reference-0.7.7.html

"Defines coordinate reference systems for projecting geographical points into pixel (screen) coordinates and back (and to coordinates in other units for WMS services). See Spatial reference system."

particularly the

"L.CRS.Simple A simple CRS that maps longitude and latitude into x and y directly. May be used for maps of flat surfaces (e.g. game maps). Note that the y axis should still be inverted (going from bottom to top)."

Game maps are very commonly just a set of pixel values similar to your data, which people project into leaflet.

1
  • 1
    Thank you! That was very helpful, I took a look at flattenjs+3djs and I think these libraries suit my needs better. Its obsolete for me to map data to a specific location anyway so why bother trying projections etc. .. :) TY
    – MMusel
    Nov 12, 2021 at 7:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.