Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I wanted to add a custom marker to my demo: http://drewwells.net/craigmaps/

Instead, I had to make a red dot to specify the place I wanted. Adding an image seems to want to layer that, but all I want is to stick the center of an icon to a lon/lat I specify.

On the same topic, is there any other way to put a point on the map than setting up a geoJSON with geometry set to point. This seemed counterintuitive, but was the only way I could figure it out with just the docs and demo to go buy.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

The easy way to add features to a map in Polymaps is via GeoJSON. You can then use Javascript to go in and modify the mark: here's a working example of simple image replacement. Basically the code replaces the GeoJSON circles with svg:image tags.

It's also possible to directly add things to the Polymaps SVG structure in your own code. You will want to use the Polymaps method locationPoint() to translate lat/lon to screen coordinates. This works great until you need to move or zoom the map; it's a bit of a challenge to implement move handling correctly. A third option is to build a custom po.layer(), see the tiles example.

share|improve this answer
    
Yay! Extremely helpful! Thanks! :-) –  Till May 6 '11 at 11:53
    
(3+ years ago, but).. What did you find difficult with move handling? I've added an SVG layer that moves and zooms with the map, and once I knew how to insert it (please ask) all event handling seems to happen automatically correctly. No custom handlers were required. –  akauppi Nov 3 at 7:26
    
I'm not sure I recall, but I suspect it is loading and paging new objects that were not visible. If you just draw all the objects offscreen you wouldn't have to worry about that. Polymaps is end of life, btw, you should probably switch to something newer like Leaflet. –  Nelson Nov 4 at 16:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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