TileCache with Mapnik for OpenStreetMap - mapping

I have an OpenStreetMap server that uses TileCache to serve tiles. The tiles are generated with Mapnik. I have configured the Mapnik XML stylesheet and I can generate an image with the OSM Mapnik tool 'generate_image.py'. That image is correct and looks good.
My TileCache server will serve tiles from my OSM layer; however, all I get are tiles with the background/water blue. I get no land forms, I get no street data. Can anybody help with this?
TileCache Config:
[osm]
type=Mapnik
mapfile=/var/maps/bin/mapnik/osm.xml
spherical_mercator=true
I am using OpenLayers to show the map. I am using a TMS layer to call the TileCache server. Like I said, I get tiles returned, they are just nothing but blue.

This is likely happening because tilecache runs as the apache user (various names) which has different privileges than your normal unix user for which you used to test tile generation with TileLite and generate_image.py.
See http://dbsgeo.com/foss4g2010/html/troubleshooting.html#trouble-postgres-connection for advice, but know this is simply a postgres issue and it is up to you to decide how to configure and your necessary security needs.

Related

Generating Images from maps

How do you capture an image of a user generated map, like one created using Leaflet.js?
Here is my example:
I have a website that generates a map.
I want to save an image of that map
e.g. when the user shares their profile, the preview image is of their map.
I know facebook, Strava, and most other services show images of a user map in their news feeds instead of showing interactive maps.
The problem
The map is generated client side, so grabbing an image of the map serverside isn't possible
Possible Solution
Once a map is generated, use PhantomJS to capture a screenshot of the map, and crop out the rest of the website.
Question
Since this is such a common thing to do, is anyone aware of a better or more standard way of grabbing these screenshots? I've seen things like the mapbox static API, but that doesn't capture the custom pins and line features on my maps.
I'm using rails for the back end.
You can make your map to be able to read the url params and set its state from it. When the user changes something on the map, the map's state is saved as url parameters and then send it/store it on the server for PhantomJS to generate it.
E.g.
&coords=123.123,10.123,54.54,45.11&zoom_level=5&....

Capturing an image from leaflet map and saving it to S3

I have a rails website where people can create custom maps using Leaflet JS. When they share those maps, I want the preview image to be an image of that map.
Right now, when a users map updates, I cache the GeoJSON that defines their map look. When I cache that GeoJSON, I would also like to grab an image of their map and save it to S3 so I can use it when they share their map.
The problem is, all the plugins I've found are designed for the user to capture their own image. Since leaflet runs in the browser, is there an easy way to capture this image, or do I need to setup a server hosted version of Leaflet?

Mapnik Blue Tiles with TileCache

I am still trying to get my server running OpenStreetMap. I have TileCache and Mapnik installed. I have an extract of the U.S. state of Oklahoma imported into my database. I have used OSM Mapnik tools to create an XML stylesheet and I have confirmed that 'generate_image.py' makes a nice map image. I have (at least I believe I have) granted PostGIS access properly. My user has full permissions over all of the tables in the database. When I look in the Apache logs, all I see are notes about cache misses (I used to see database connection issues, but I don't any more). In the Postgres logs, I don't see anything (again, I used to see access denied issues, but I don't anymore). Despite all of this, when I ask TileCache to render a tile from the OSM Mapnik layer, all I get is this image:
This image shows up no matter where I am on the map or what zoom level I am at. I have TileCache running under CGI and it has a configuration like this:
[osm]
type=Mapnik
mapfile=/var/maps/bin/mapnik/osm.xml
spherical_mercator=true
I am using OpenLayers and my Javascript looks like this:
var map = new OpenLayers.Map("mapdiv");
var vec = new OpenLayers.Layer.TMS("TC", "http://maps.company.com/cgi-bin/tilecache/tilecache.cgi/", {serviceVersion: "1.0.0", layername: "osm", type: "png"});
map.addLayer(vec);
I have been working on this server for two and a half weeks. I have read every blog, forum, or other post I can find. This is my third question today. I am getting desperate. I would really appreciate any help anybody has.
Can you confirm that you have valid data in postgis? Opening up the data in Quantum GIS is a good way to check.

Drawing tree diagram in ASP.Net MVC

I am creating an web application for my tae kwon do club.
People are able to register online for a tournament.
After the registration deadline the web application generates a dendrogram. Something like this:
I am wondering now how to draw it.
Because of the fact that there are my weight and age categories i have to draw them dynamicly for each group.
What is the easiest way to draw this inside a MVC view?
You probably have two choices:
Draw it on the server using gdi and sending the resultant bitmap over the pipe to the browser.
Draw it on the client using canvas. If you can control the browser that is being used, this may not be a bad idea. Otherwise, stick with the server side rendering.
Although it looks like you could do it using borders around HTML elements, I wouldn't. By the time you fight those battles, you could have the server side rendering done.
Hope this helps to get you started.
Bob
If you want to draw an image on the server, then just send it to the browser as a .jpg, See if QuickGraph will do what you need. It's not specific to dendrograms, but i think it's probably flexible enough to do it.

Issues with Filemaker IWP working with hyperlinks on images

I have a filemaker database that I need to be able to link records and all associated data (including container field data) to various points placed on a large PDF image, and then make that data appear via instant web publishing when someone clicks on the marker for that area on the PDF. For example the PDF may be an image of a car, and then I would have various close up images of issues with the car and descriptions of those images as records in the database. I would then want to drop points on the base PDF image and when you clicked on those points be able to see the close up images and other data related to those images.
I'm being told this is too much for IWP because:
I need to place the markers outside filemaker via PDF annotation
Filemaker IWP can't handle the number of markers that may be necessary (it could be up to 1,000 on an E sized image.
Does anyone have a work around or explanation why this is a problem?
If I understand correctly, you would like to setup a PDF with links that will open a browser and show data related to what was clicked. Assuming that is the case, the reason this wont work is because IWP does not provide a unique URL for a unique page. For example, here on StackOverflow you can directly link to any question based on its URL:
http://stackoverflow.com/questions/3207775/ -- this question
http://stackoverflow.com/questions/4973921/ -- some other question
IWP uses Javascript and session variables to manipulate the output to the screen, so there is no way to link to a specific section of your IWP site, since the URL is always something like:
http://yoursite.com/fmi/iwp/cgi?-db=YOUR_DB-loadframes -- Product A
http://yoursite.com/fmi/iwp/cgi?-db=YOUR_DB-loadframes -- Product B
http://yoursite.com/fmi/iwp/cgi?-db=YOUR_DB-loadframes -- Product C
Because of the limited nature of IWP, you will not be able to workaround this issue. You'll need to build your own web-interface using the Custom Web Publishing Engine, either using the built-in PHP extensions or some other technology where you invoke the XML publishing API.
I agree with Nate
IWP is the wrong solution to this problem. You'd be better off simply hosting those images on a webserver.
Now here comes the plug, you can use SuperContainer to really simplify the management of the images from FileMaker.

Resources