Hot answers tagged jquery
10
Use the OpenLayers.Format.WKT class.
Try replacing this line:
var fea=new OpenLayers.Feature.Vector(data); //this doesn't work
For this line(if data.d = "POLYGON((516000 ..."):
var fea = new OpenLayers.Format.WKT().read(data.d);
Here's an example on how to use it:
http://openlayers.org/dev/examples/vector-formats.html
4
Essentially, you are just passing an array to the autocomplete widget. If the data is in a map or feature service, query for the data from the service. If you start with a table in your mxd/msd that contains the data, when you publish it, you will get a REST endpoint for the table to query for in the same way. Next, parse out the data and push onto an array ...
4
You have two options:
hook into the create event to adjust layer opacity as sliders are created
provide a global cfg array so that layers are already init'ed to same value as the sliders
The first solution is simple, just provide a create: function(event, ui) { ... } as an init option to the slider like the following:
$( "#slider1" ).slider({
[...]
...
3
To complete unicoletti's answer. You can have a look on opengeo workshop.
There is an example combining openlayers and Jquery UI slider.
The full OL tutorial is available here.
3
Try this instead:
function getJson(simp){ //Removed unneeded arguments here
var url = 'file' + simp + '.json';
map.removeLayer(geojsonLayer);
//geojsonLayer.clearLayers(); I don't believe this needed.
$.getJSON(url, function(data){
geojsonLayer = L.geoJson(data, {
style: defaultStyle,
onEachFeature: ...
3
Yes, many people do use JQuery Mobile together with their choice of mapping API. I use both google maps and ESRI's JavaScript web mapping APIs with JQuery Mobile. If you are planning on doing it with the Google Maps v3 API here is a great set of examples.
2
An OL extension has been coded for that.
You will find a blog post relative to the draggable behavior and the extension implementation : http://aamirafridi.com/openlayers/openlayers-draggable-popups
With a link to the demo : http://jsbin.com/agopa3
The extension full code is available on the blog page. Hope it helps.
2
See this DEMO.
I've recreated your code in the DEMO and it works fine. Without the complete source it's hard to tell what is causing your problem. Your code was throwing an error and was easily fixed by doing what Vadim mentioned: "switch last 2 statements".
I have a feeling it has something to do with the source of rPoly(reading from KML). Because that's ...
1
Well I see two issues. The first issue is that in the while statement you are using "lon" instead of "lng" like you defined in your data.
{lat: 33.5363, lng:-117.044, count: 1}
Here is the typo:
new OpenLayers.LonLat(data[datalen].lon, data[datalen].lat)
So longitude is NaN when you try to load it, discovered this debuggin with firebug. The second ...
1
Before you figure out which one to use, you need to understand the difference between jQuery and ExtJs. jQuery includes features like DOM Manipulation, Event Handling, AJAX and allows it to be Extended through plugins. On its own, it includes very little UI components.
ExtJs on the other hand is a complete framework, which includes all of the above, and ...
1
Use .on() instead of .live() - the element is not onpage when you bind your event handler, so you'll need to bind it dynamically.
$('click', 'a .smallPolygonLink', function(e){
console.log("One of the many Small Polygon Links were Clicked");
});
1
create a function to loop through your addresses and create a marker for each one.
then call this function on the click event of your element (div, link, etc).
example:
HTML
<a href="javascript:google.maps.event.trigger(gmarkers['Location 1'],'click');" class="button3">Location 1</a>
<a ...
1
I think I read somewhere recently that Markers is not the recommended way to do this anymore, that support would not continue, just not 100% sure about it and I can't find it back immediately. But you could easily make geoJSON from this code which is just another Vector layer. Since now you are actually trying to do what the OpenLayers api has implemented ...
1
Thanks unicoletti, the callback change worked. I now have:
$.ajax({
url: "http://localhost:8090/geoserver/cite/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=cite:markers&maxFeatures=50&outputFormat=json&format_options=callback:processMarkers",
dataType: "jsonp",
});
and it returns the json, which I successfully ...
1
first of all check if your server, and website are on same domain and port. Because of XSS (cross site-scripting) it can be hard to connect via AJAX to different domain. Secound of all this question is similar to this: How do I get GeoJSON data from GeoServer into show up on my Leaflet map? so I recommend you to use build-in geoserver method instead of using ...
1
GeoServer has its own convention for JSONP callbacks, which is described here (coudn't find it mentioned in the official docs).
So I quickly hacked a jsfiddle showing how you can use it with jQuery, just remember to set the url, workspace and layers so that they point to your geoserver.
1
OK. so I figured it out!!! :)
the problem was as I wrote before - when I release mouse button, but still moves mouse over the screen the map was moving with me. (only in google chrome) but when I changed event from onPanStart/Stop to onMouseDragStart/Stop everything works good, but I had to check if pan tool is active.
1
I continue to get an error in my new page saying that 'map' is undefined
To determine whether the 'map' is undefined error is referring to the "old" map or the "new" map, can you ensure that you've given them unique names?
I can see in Firebug that my function to set the new extent based on
the extent of the original page runs before the page is ...
Only top voted, non community-wiki answers of a minimum length are eligible
